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
768b835e
Commit
768b835e
authored
Dec 13, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate docs
parent
5feb3529
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
65 deletions
+14
-65
examples/FasterRCNN/README.md
examples/FasterRCNN/README.md
+10
-7
tensorpack/graph_builder/model_desc.py
tensorpack/graph_builder/model_desc.py
+4
-4
tensorpack/utils/argtools.py
tensorpack/utils/argtools.py
+0
-2
tensorpack/utils/globvars.py
tensorpack/utils/globvars.py
+0
-52
No files found.
examples/FasterRCNN/README.md
View file @
768b835e
# Faster R-CNN / Mask R-CNN on COCO
This example provides a minimal (2k lines) and faithful implementation of the following papers:
This example provides a minimal (2k lines) and faithful implementation of the
following object detection / instance segmentation papers:
+
[
Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
](
https://arxiv.org/abs/1506.01497
)
+
[
Feature Pyramid Networks for Object Detection
](
https://arxiv.org/abs/1612.03144
)
...
...
@@ -13,11 +14,11 @@ with the support of:
+
Training from scratch (from
[
Rethinking ImageNet Pre-training
](
https://arxiv.org/abs/1811.08883
)
)
## Dependencies
+
Python 3.3+; OpenCV
.
+
TensorFlow ≥ 1.6
(1.4 or 1.5 can run but may crash due to a TF bug);
+
Python 3.3+; OpenCV
+
TensorFlow ≥ 1.6
+
pycocotools:
`pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'`
+
Pre-trained
[
ImageNet ResNet model
](
http://models.tensorpack.com/FasterRCNN/
)
from tensorpack model zoo
.
from tensorpack model zoo
+
[
COCO data
](
http://cocodataset.org/#download
)
. It needs to have the following directory structure:
```
COCO/DIR/
...
...
@@ -78,15 +79,17 @@ These models are trained on trainval35k and evaluated on minival2014 using mAP@I
All models are fine-tuned from ImageNet pre-trained R50/R101 models in
[
tensorpack model zoo
](
http://models.tensorpack.com/FasterRCNN/
)
, unless otherwise noted.
All models are trained with 8 NVIDIA V100s, unless otherwise noted.
Performance in
[
Detectron
](
https://github.com/facebookresearch/Detectron/
)
can be roughly reproduced.
FPN models are sometimes slightly worse, which is mainly due to batch size.
| Backbone | mAP
<br/>
(box;mask) | Detectron mAP
<sup>
[
1
](
#ft1
)
</sup><br/>
(box;mask) | Time (on 8 V100s) | Configurations
<br/>
(click to expand) |
| - | - | - | - | - |
| R50-C4 | 33.1 | | 18h |
<details><summary>
super quick
</summary>
`MODE_MASK=False FRCNN.BATCH_PER_IM=64`
<br/>
`PREPROC.SHORT_EDGE_SIZE=600 PREPROC.MAX_SIZE=1024`
<br/>
`TRAIN.LR_SCHEDULE=[150000,230000,280000]`
</details>
|
| R50-C4 | 36.6 | 36.5 | 44h |
<details><summary>
standard
</summary>
`MODE_MASK=False`
</details>
|
| R50-FPN | 37.4 | 37.9 | 2
9
h |
<details><summary>
standard
</summary>
`MODE_MASK=False MODE_FPN=True`
</details>
|
| R50-C4 | 38.2;33.3
[
:arrow_down:
](
http://models.tensorpack.com/FasterRCNN/COCO-R50C4-MaskRCNN-Standard.npz
)
| 37.8;32.8 | 4
9
h |
<details><summary>
standard
</summary>
this is the default
</details>
|
| R50-FPN | 38.
5;35.2
[
:arrow_down:
](
http://models.tensorpack.com/FasterRCNN/COCO-R50FPN-MaskRCNN-Standard.npz
)
| 38.6;34.5 | 30
h |
<details><summary>
standard
</summary>
`MODE_FPN=True`
</details>
|
| R50-FPN | 37.4 | 37.9 | 2
7
h |
<details><summary>
standard
</summary>
`MODE_MASK=False MODE_FPN=True`
</details>
|
| R50-C4 | 38.2;33.3
[
:arrow_down:
](
http://models.tensorpack.com/FasterRCNN/COCO-R50C4-MaskRCNN-Standard.npz
)
| 37.8;32.8 | 4
8
h |
<details><summary>
standard
</summary>
this is the default
</details>
|
| R50-FPN | 38.
4;35.1
[
:arrow_down:
](
http://models.tensorpack.com/FasterRCNN/COCO-R50FPN-MaskRCNN-Standard.npz
)
| 38.6;34.5 | 28
h |
<details><summary>
standard
</summary>
`MODE_FPN=True`
</details>
|
| R50-FPN | 42.0;36.3 | | 41h |
<details><summary>
+Cascade
</summary>
`MODE_FPN=True FPN.CASCADE=True`
</details>
|
| R50-FPN | 39.5;35.2 | 39.5;34.4
<sup>
[
2
](
#ft2
)
</sup>
| 33h |
<details><summary>
+ConvGNHead
</summary>
`MODE_FPN=True`
<br/>
`FPN.FRCNN_HEAD_FUNC=fastrcnn_4conv1fc_gn_head`
</details>
|
| R50-FPN | 40.0;36.2
[
:arrow_down:
](
http://models.tensorpack.com/FasterRCNN/COCO-R50FPN-MaskRCNN-StandardGN.npz
)
| 40.3;35.7 | 40h |
<details><summary>
+GN
</summary>
`MODE_FPN=True`
<br/>
`FPN.NORM=GN BACKBONE.NORM=GN`
<br/>
`FPN.FRCNN_HEAD_FUNC=fastrcnn_4conv1fc_gn_head`
<br/>
`FPN.MRCNN_HEAD_FUNC=maskrcnn_up4conv_gn_head`
|
...
...
tensorpack/graph_builder/model_desc.py
View file @
768b835e
...
...
@@ -37,8 +37,7 @@ class InputDesc(
self
.
_cached_placeholder
=
{}
return
self
# TODO this method seems unused outside this class
def
build_placeholder
(
self
):
def
_build_placeholder
(
self
):
"""
Build a tf.placeholder from the metadata.
...
...
@@ -63,7 +62,7 @@ class InputDesc(
if
g
in
self
.
_cached_placeholder
:
return
self
.
_cached_placeholder
[
g
]
else
:
return
self
.
build_placeholder
()
return
self
.
_
build_placeholder
()
def
_register_cached_placeholder
(
self
,
placeholder
):
graph
=
placeholder
.
graph
...
...
@@ -241,12 +240,13 @@ class ModelDesc(ModelDescBase):
def
_build_graph_get_cost
(
self
,
*
inputs
):
"""
Equivalent to `build_graph`.
Used internally by trainers to get the final cost for optimization in a backward-compatible way.
"""
ret
=
self
.
build_graph
(
*
inputs
)
if
not
get_current_tower_context
()
.
is_training
:
return
None
# this is the tower function, could be called for inference
if
isinstance
(
ret
,
tf
.
Tensor
):
# the preferred way
if
ret
is
not
None
:
return
ret
else
:
# the old way, for compatibility
return
self
.
get_cost
()
tensorpack/utils/argtools.py
View file @
768b835e
...
...
@@ -75,8 +75,6 @@ def memoized_ignoreargs(func):
A decorator. It performs memoization ignoring the arguments used to call
the function.
"""
hash
(
func
)
# make sure it is hashable. TODO is it necessary?
def
wrapper
(
*
args
,
**
kwargs
):
if
func
not
in
_MEMOIZED_NOARGS
:
res
=
func
(
*
args
,
**
kwargs
)
...
...
tensorpack/utils/globvars.py
deleted
100644 → 0
View file @
5feb3529
# -*- coding: utf-8 -*-
# File: globvars.py
import
six
import
argparse
from
.
import
logger
__all__
=
[
'globalns'
,
'GlobalNS'
]
if
six
.
PY2
:
class
NS
:
pass
else
:
import
types
NS
=
types
.
SimpleNamespace
# TODO make it singleton
class
GlobalNS
(
NS
):
"""
The class of the globalns instance.
"""
def
use_argument
(
self
,
args
):
"""
Add the content of :class:`argparse.Namespace` to this ns.
Args:
args (argparse.Namespace): arguments
"""
assert
isinstance
(
args
,
argparse
.
Namespace
),
type
(
args
)
for
k
,
v
in
six
.
iteritems
(
vars
(
args
)):
if
hasattr
(
self
,
k
):
logger
.
warn
(
"Attribute {} in globalns will be overwritten!"
)
setattr
(
self
,
k
,
v
)
globalns
=
GlobalNS
()
"""
A namespace to store global variables.
Example:
.. code-block:: none
import tensorpack.utils.globalns as G
G.depth = 18
G.batch_size = 1
G.use_argument(parser.parse_args())
"""
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