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
0050d6e7
Commit
0050d6e7
authored
Jul 15, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update docs
parent
264b1e4e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
9 deletions
+10
-9
examples/FasterRCNN/coco.py
examples/FasterRCNN/coco.py
+1
-1
examples/FasterRCNN/common.py
examples/FasterRCNN/common.py
+2
-2
examples/FasterRCNN/config.py
examples/FasterRCNN/config.py
+1
-1
examples/FasterRCNN/data.py
examples/FasterRCNN/data.py
+3
-3
examples/FasterRCNN/model_frcnn.py
examples/FasterRCNN/model_frcnn.py
+1
-1
examples/FasterRCNN/viz.py
examples/FasterRCNN/viz.py
+1
-0
tensorpack/tfutils/varmanip.py
tensorpack/tfutils/varmanip.py
+1
-1
No files found.
examples/FasterRCNN/coco.py
View file @
0050d6e7
...
@@ -12,7 +12,6 @@ from tensorpack.utils.rect import FloatBox
...
@@ -12,7 +12,6 @@ from tensorpack.utils.rect import FloatBox
from
tensorpack.utils.timer
import
timed_operation
from
tensorpack.utils.timer
import
timed_operation
from
tensorpack.utils.argtools
import
log_once
from
tensorpack.utils.argtools
import
log_once
from
pycocotools.coco
import
COCO
from
config
import
config
as
cfg
from
config
import
config
as
cfg
...
@@ -63,6 +62,7 @@ class COCODetection(object):
...
@@ -63,6 +62,7 @@ class COCODetection(object):
basedir
,
'annotations/instances_{}.json'
.
format
(
name
))
basedir
,
'annotations/instances_{}.json'
.
format
(
name
))
assert
os
.
path
.
isfile
(
annotation_file
),
annotation_file
assert
os
.
path
.
isfile
(
annotation_file
),
annotation_file
from
pycocotools.coco
import
COCO
self
.
coco
=
COCO
(
annotation_file
)
self
.
coco
=
COCO
(
annotation_file
)
# initialize the meta
# initialize the meta
...
...
examples/FasterRCNN/common.py
View file @
0050d6e7
...
@@ -7,8 +7,6 @@ import cv2
...
@@ -7,8 +7,6 @@ import cv2
from
tensorpack.dataflow
import
RNGDataFlow
from
tensorpack.dataflow
import
RNGDataFlow
from
tensorpack.dataflow.imgaug
import
transform
from
tensorpack.dataflow.imgaug
import
transform
import
pycocotools.mask
as
cocomask
class
DataFromListOfDict
(
RNGDataFlow
):
class
DataFromListOfDict
(
RNGDataFlow
):
def
__init__
(
self
,
lst
,
keys
,
shuffle
=
False
):
def
__init__
(
self
,
lst
,
keys
,
shuffle
=
False
):
...
@@ -95,6 +93,8 @@ def segmentation_to_mask(polys, height, width):
...
@@ -95,6 +93,8 @@ def segmentation_to_mask(polys, height, width):
a binary matrix of (height, width)
a binary matrix of (height, width)
"""
"""
polys
=
[
p
.
flatten
()
.
tolist
()
for
p
in
polys
]
polys
=
[
p
.
flatten
()
.
tolist
()
for
p
in
polys
]
import
pycocotools.mask
as
cocomask
rles
=
cocomask
.
frPyObjects
(
polys
,
height
,
width
)
rles
=
cocomask
.
frPyObjects
(
polys
,
height
,
width
)
rle
=
cocomask
.
merge
(
rles
)
rle
=
cocomask
.
merge
(
rles
)
return
cocomask
.
decode
(
rle
)
return
cocomask
.
decode
(
rle
)
...
...
examples/FasterRCNN/config.py
View file @
0050d6e7
...
@@ -64,7 +64,7 @@ _C.DATA.BASEDIR = '/path/to/your/COCO/DIR'
...
@@ -64,7 +64,7 @@ _C.DATA.BASEDIR = '/path/to/your/COCO/DIR'
_C
.
DATA
.
TRAIN
=
[
'train2014'
,
'valminusminival2014'
]
# i.e., trainval35k
_C
.
DATA
.
TRAIN
=
[
'train2014'
,
'valminusminival2014'
]
# i.e., trainval35k
_C
.
DATA
.
VAL
=
'minival2014'
# For now, only support evaluation on single dataset
_C
.
DATA
.
VAL
=
'minival2014'
# For now, only support evaluation on single dataset
_C
.
DATA
.
NUM_CATEGORY
=
80
# 80 categories.
_C
.
DATA
.
NUM_CATEGORY
=
80
# 80 categories.
_C
.
DATA
.
CLASS_NAMES
=
[]
# NUM_CLASS
strings. Needs to be populated later by data loader
_C
.
DATA
.
CLASS_NAMES
=
[]
# NUM_CLASS
(NUM_CATEGORY+1) strings, to be populated later by data loader. The first is BG.
# basemodel ----------------------
# basemodel ----------------------
_C
.
BACKBONE
.
WEIGHTS
=
''
# /path/to/weights.npz
_C
.
BACKBONE
.
WEIGHTS
=
''
# /path/to/weights.npz
...
...
examples/FasterRCNN/data.py
View file @
0050d6e7
...
@@ -264,9 +264,9 @@ def get_train_dataflow():
...
@@ -264,9 +264,9 @@ def get_train_dataflow():
To train on your own data, change this to your loader.
To train on your own data, change this to your loader.
Produce "imgs" as a list of dict, in the dict the following keys are needed for training:
Produce "imgs" as a list of dict, in the dict the following keys are needed for training:
height, width: integer
height, width: integer
file_name: str
file_name: str
, full path to the image
boxes: kx4 floats
boxes:
numpy array of
kx4 floats
class: k integers
class:
numpy array of
k integers
is_crowd: k booleans. Use k False if you don't know what it means.
is_crowd: k booleans. Use k False if you don't know what it means.
segmentation: k lists of numpy arrays (one for each box).
segmentation: k lists of numpy arrays (one for each box).
Each list of numpy array corresponds to the mask for one instance.
Each list of numpy array corresponds to the mask for one instance.
...
...
examples/FasterRCNN/model_frcnn.py
View file @
0050d6e7
...
@@ -239,7 +239,7 @@ def fastrcnn_2fc_head(feature, num_classes):
...
@@ -239,7 +239,7 @@ def fastrcnn_2fc_head(feature, num_classes):
def
fastrcnn_Xconv1fc_head
(
feature
,
num_classes
,
num_convs
,
norm
=
None
):
def
fastrcnn_Xconv1fc_head
(
feature
,
num_classes
,
num_convs
,
norm
=
None
):
"""
"""
Args:
Args:
feature (
any shape
):
feature (
NCHW
):
num_classes(int): num_category + 1
num_classes(int): num_category + 1
num_convs (int): number of conv layers
num_convs (int): number of conv layers
norm (str or None): either None or 'GN'
norm (str or None): either None or 'GN'
...
...
examples/FasterRCNN/viz.py
View file @
0050d6e7
...
@@ -12,6 +12,7 @@ from config import config as cfg
...
@@ -12,6 +12,7 @@ from config import config as cfg
def
draw_annotation
(
img
,
boxes
,
klass
,
is_crowd
=
None
):
def
draw_annotation
(
img
,
boxes
,
klass
,
is_crowd
=
None
):
"""Will not modify img"""
labels
=
[]
labels
=
[]
assert
len
(
boxes
)
==
len
(
klass
)
assert
len
(
boxes
)
==
len
(
klass
)
if
is_crowd
is
not
None
:
if
is_crowd
is
not
None
:
...
...
tensorpack/tfutils/varmanip.py
View file @
0050d6e7
...
@@ -178,7 +178,7 @@ def get_checkpoint_path(model_path):
...
@@ -178,7 +178,7 @@ def get_checkpoint_path(model_path):
elif
model_path
.
endswith
(
'.index'
):
elif
model_path
.
endswith
(
'.index'
):
new_path
=
model_path
.
split
(
'.index'
)[
0
]
new_path
=
model_path
.
split
(
'.index'
)[
0
]
if
new_path
!=
model_path
:
if
new_path
!=
model_path
:
logger
.
warn
(
logger
.
info
(
"Checkpoint path {} is auto-corrected to {}."
.
format
(
model_path
,
new_path
))
"Checkpoint path {} is auto-corrected to {}."
.
format
(
model_path
,
new_path
))
model_path
=
new_path
model_path
=
new_path
assert
tf
.
gfile
.
Exists
(
model_path
)
or
tf
.
gfile
.
Exists
(
model_path
+
'.index'
),
model_path
assert
tf
.
gfile
.
Exists
(
model_path
)
or
tf
.
gfile
.
Exists
(
model_path
+
'.index'
),
model_path
...
...
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