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
37530d96
Commit
37530d96
authored
Jul 12, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MaskRCNN] small change on data loading
parent
d2309a1b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
+8
-5
examples/FasterRCNN/README.md
examples/FasterRCNN/README.md
+1
-1
examples/FasterRCNN/coco.py
examples/FasterRCNN/coco.py
+3
-2
examples/FasterRCNN/config.py
examples/FasterRCNN/config.py
+1
-0
examples/FasterRCNN/train.py
examples/FasterRCNN/train.py
+3
-2
No files found.
examples/FasterRCNN/README.md
View file @
37530d96
...
...
@@ -12,7 +12,7 @@ with the support of:
## Dependencies
+
Python 3; TensorFlow >= 1.6 (1.4 or 1.5 can run but may crash due to a TF bug);
+
[
pycocotools
](
https://github.com/pdollar/coco/tree/master/PythonAPI/
pycocotools
)
, OpenCV.
+
[
pycocotools
](
https://github.com/pdollar/coco/tree/master/PythonAPI/
)
, OpenCV.
+
Pre-trained
[
ImageNet ResNet model
](
http://models.tensorpack.com/FasterRCNN/
)
from tensorpack model zoo. Use the models with "-AlignPadding".
+
COCO data. It needs to have the following directory structure:
...
...
examples/FasterRCNN/coco.py
View file @
37530d96
...
...
@@ -116,8 +116,9 @@ class COCODetection(object):
Add 'boxes', 'class', 'is_crowd' of this image to the dict, used by detection.
If add_mask is True, also add 'segmentation' in coco poly format.
"""
ann_ids
=
self
.
coco
.
getAnnIds
(
imgIds
=
img
[
'id'
],
iscrowd
=
None
)
objs
=
self
.
coco
.
loadAnns
(
ann_ids
)
# ann_ids = self.coco.getAnnIds(imgIds=img['id'])
# objs = self.coco.loadAnns(ann_ids)
objs
=
self
.
coco
.
imgToAnns
[
img
[
'id'
]]
# equivalent but faster than the above two lines
# clean-up boxes
valid_objs
=
[]
...
...
examples/FasterRCNN/config.py
View file @
37530d96
...
...
@@ -164,6 +164,7 @@ def finalize_configs(is_training):
Run some sanity checks, and populate some configs from others
"""
_C
.
DATA
.
NUM_CLASS
=
_C
.
DATA
.
NUM_CATEGORY
+
1
# +1 background
_C
.
DATA
.
BASEDIR
=
os
.
path
.
expanduser
(
_C
.
DATA
.
BASEDIR
)
assert
_C
.
BACKBONE
.
NORM
in
[
'FreezeBN'
,
'SyncBN'
,
'GN'
],
_C
.
BACKBONE
.
NORM
if
_C
.
BACKBONE
.
NORM
!=
'FreezeBN'
:
...
...
examples/FasterRCNN/train.py
View file @
37530d96
...
...
@@ -89,7 +89,7 @@ class DetectionModel(ModelDesc):
with
tf
.
name_scope
(
'fg_sample_patch_viz'
):
fg_sampled_patches
=
crop_and_resize
(
image
,
fg_rcnn_boxes
,
tf
.
zeros
(
tf
.
shape
(
fg_rcnn_boxes
)[
0
],
dtype
=
tf
.
int32
),
300
)
tf
.
zeros
(
[
tf
.
shape
(
fg_rcnn_boxes
)[
0
]
],
dtype
=
tf
.
int32
),
300
)
fg_sampled_patches
=
tf
.
transpose
(
fg_sampled_patches
,
[
0
,
2
,
3
,
1
])
fg_sampled_patches
=
tf
.
reverse
(
fg_sampled_patches
,
axis
=
[
-
1
])
# BGR->RGB
tf
.
summary
.
image
(
'viz'
,
fg_sampled_patches
,
max_outputs
=
30
)
...
...
@@ -517,6 +517,7 @@ if __name__ == '__main__':
logger
.
warn
(
"TF<1.6 has a bug which may lead to crash in FasterRCNN training if you're unlucky."
)
args
=
parser
.
parse_args
()
if
args
.
config
:
cfg
.
update_args
(
args
.
config
)
MODEL
=
ResNetFPNModel
()
if
cfg
.
MODE_FPN
else
ResNetC4Model
()
...
...
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