Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
4768b265
Commit
4768b265
authored
Dec 27, 2019
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more pickability in dataflow
parent
1648dddb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
14 deletions
+25
-14
examples/FasterRCNN/convert_d2/README.md
examples/FasterRCNN/convert_d2/README.md
+13
-7
tensorpack/dataflow/raw.py
tensorpack/dataflow/raw.py
+12
-7
No files found.
examples/FasterRCNN/convert_d2/README.md
View file @
4768b265
...
@@ -9,6 +9,7 @@ It produces a corresponding tensorpack configs, as well as a tensorpack-compatib
...
@@ -9,6 +9,7 @@ It produces a corresponding tensorpack configs, as well as a tensorpack-compatib
It currently supports ResNet{50,101}-{C4,FPN}-{Faster,Mask,Cascade} R-CNN models in
It currently supports ResNet{50,101}-{C4,FPN}-{Faster,Mask,Cascade} R-CNN models in
[
detectron2 model zoo
](
https://github.com/facebookresearch/detectron2/blob/master/MODEL_ZOO.md
)
.
[
detectron2 model zoo
](
https://github.com/facebookresearch/detectron2/blob/master/MODEL_ZOO.md
)
.
You may add new architectures in
`../modeling`
to support more models.
### Usage:
### Usage:
...
@@ -27,12 +28,17 @@ $ ./predict.py --evaluate out.json --load R50FPN-d2-converted.npz --config DATA
...
@@ -27,12 +28,17 @@ $ ./predict.py --evaluate out.json --load R50FPN-d2-converted.npz --config DATA
$ ./predict.py --output-pb out.pb --load R50FPN-d2-converted.npz --config DATA.BASEDIR=~/data/coco 'MODE_MASK=True' 'MODE_FPN=True' 'BACKBONE.STRIDE_1X1=True' 'PREPROC.PIXEL_MEAN=[123.675,116.28,103.53]' 'PREPROC.PIXEL_STD=[1.0,1.0,1.0]'
$ ./predict.py --output-pb out.pb --load R50FPN-d2-converted.npz --config DATA.BASEDIR=~/data/coco 'MODE_MASK=True' 'MODE_FPN=True' 'BACKBONE.STRIDE_1X1=True' 'PREPROC.PIXEL_MEAN=[123.675,116.28,103.53]' 'PREPROC.PIXEL_STD=[1.0,1.0,1.0]'
```
```
Note: this script does not support arbitrary detectron2 config.
Note:
When run against an unsupported config, it may fail silently and produce
erroneous models.
For models in detectron2 model zoo, there is a small incompatibility:
1.
This script does not support arbitrary detectron2 config.
When run against an unsupported config, it may fail silently and produce
erroneous models.
*
`POOLER_SAMPLING_RATIO=0`
in RoIAlign: there is no equivalence in TensorFlow.
2.
The above steps produces a TensorFlow's pb file without any inference-time optimization (such as fusion).
Tensorpack is a training framework so it does not provide any such tools.
It's up to the user to further optimize the final graph.
3.
There could be a small incompatibility for converted models.
For the implementation of RoIAlign, there is no equivalence of
`POOLER_SAMPLING_RATIO=0`
in tensorpack or TensorFlow.
Our RoIAlign only implements
`POOLER_SAMPLING_RATIO=2`
.
Our RoIAlign only implements
`POOLER_SAMPLING_RATIO=2`
.
The results are quite similar, and the final AP may be different by <0.5.
The results are quite similar, and the final AP may be different by <0.5.
tensorpack/dataflow/raw.py
View file @
4768b265
...
@@ -103,12 +103,12 @@ class DataFromGenerator(DataFlow):
...
@@ -103,12 +103,12 @@ class DataFromGenerator(DataFlow):
Args:
Args:
gen: iterable, or a callable that returns an iterable
gen: iterable, or a callable that returns an iterable
"""
"""
if
not
callable
(
gen
):
self
.
_gen
=
lambda
:
gen
else
:
self
.
_gen
=
gen
self
.
_gen
=
gen
def
__iter__
(
self
):
def
__iter__
(
self
):
if
not
callable
(
self
.
_gen
):
yield
from
self
.
_gen
else
:
yield
from
self
.
_gen
()
yield
from
self
.
_gen
()
...
@@ -117,12 +117,17 @@ class DataFromIterable(DataFlow):
...
@@ -117,12 +117,17 @@ class DataFromIterable(DataFlow):
def
__init__
(
self
,
iterable
):
def
__init__
(
self
,
iterable
):
"""
"""
Args:
Args:
iterable: an iterable object
with length
iterable: an iterable object
"""
"""
self
.
_itr
=
iterable
self
.
_itr
=
iterable
try
:
self
.
_len
=
len
(
iterable
)
self
.
_len
=
len
(
iterable
)
except
Exception
:
self
.
_len
=
None
def
__len__
(
self
):
def
__len__
(
self
):
if
self
.
_len
is
None
:
raise
NotImplementedError
return
self
.
_len
return
self
.
_len
def
__iter__
(
self
):
def
__iter__
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment