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
9383740f
Commit
9383740f
authored
Jun 01, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update docs
parent
b892867c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
27 deletions
+25
-27
.github/ISSUE_TEMPLATE.md
.github/ISSUE_TEMPLATE.md
+2
-2
examples/FasterRCNN/README.md
examples/FasterRCNN/README.md
+5
-5
examples/FasterRCNN/train.py
examples/FasterRCNN/train.py
+17
-19
tensorpack/train/trainers.py
tensorpack/train/trainers.py
+1
-1
No files found.
.github/ISSUE_TEMPLATE.md
View file @
9383740f
...
...
@@ -3,7 +3,7 @@ An issue has to be one of the following:
2.
Feature Requests
3.
Usage Questions
Any unexpected problems:
__PLEASE ALWAYS INCLUDE__:
For any unexpected problems,
__PLEASE ALWAYS INCLUDE__:
1.
What you did:
+
If you're using examples:
+
What's the command you run:
...
...
@@ -17,7 +17,7 @@ Any unexpected problems: __PLEASE ALWAYS INCLUDE__:
4.
Your environment:
+
Python version.
+
TF version:
`python -c 'import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)'`
.
+
Tensorpack version:
`python
3
-c 'import tensorpack; print(tensorpack.__version__)'`
.
+
Tensorpack version:
`python -c 'import tensorpack; print(tensorpack.__version__)'`
.
You can install Tensorpack master by
`pip install -U git+https://github.com/ppwwyyxx/tensorpack.git`
.:
5.
About efficiency, PLEASE first read http://tensorpack.readthedocs.io/en/latest/tutorial/performance-tuning.html
...
...
examples/FasterRCNN/README.md
View file @
9383740f
# Faster-RCNN / Mask-RCNN on COCO
This example provides a minimal (only 1.6k lines)
but
faithful implementation of the following papers:
This example provides a minimal (only 1.6k lines)
and
faithful implementation of the following 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
)
...
...
@@ -8,8 +8,8 @@ This example provides a minimal (only 1.6k lines) but faithful implementation of
## Dependencies
+
Python 3; TensorFlow >= 1.4.0 (>=1.6.0 recommended due to a TF bug);
+
[
pycocotools
](
https://github.com/pdollar/coco/tree/master/PythonAPI/pycocotools
)
, OpenCV.
+
Pre-trained
[
ResNet model
](
http://models.tensorpack.com/ResNet/
)
from tensorpack model zoo.
+
COCO data. It
assumes
the following directory structure:
+
Pre-trained
[
ImageNet
ResNet model
](
http://models.tensorpack.com/ResNet/
)
from tensorpack model zoo.
+
COCO data. It
needs to have
the following directory structure:
```
DIR/
annotations/
...
...
@@ -44,9 +44,9 @@ Predict on an image (and show output in a window):
```
Evaluate the performance of a model on COCO, and save results to json.
(
Pretrained
models can be downloaded in
[
model zoo
](
http://models.tensorpack.com/FasterRCNN
)
:
(
Trained COCO
models can be downloaded in
[
model zoo
](
http://models.tensorpack.com/FasterRCNN
)
:
```
./train.py --evaluate output.json --load /path/to/
model
./train.py --evaluate output.json --load /path/to/
COCO-ResNet50-MaskRCNN.npz
```
## Results
...
...
examples/FasterRCNN/train.py
View file @
9383740f
...
...
@@ -70,19 +70,6 @@ def get_model():
class
DetectionModel
(
ModelDesc
):
def
inputs
(
self
):
ret
=
[
tf
.
placeholder
(
tf
.
float32
,
(
None
,
None
,
3
),
'image'
),
tf
.
placeholder
(
tf
.
int32
,
(
None
,
None
,
config
.
NUM_ANCHOR
),
'anchor_labels'
),
tf
.
placeholder
(
tf
.
float32
,
(
None
,
None
,
config
.
NUM_ANCHOR
,
4
),
'anchor_boxes'
),
tf
.
placeholder
(
tf
.
float32
,
(
None
,
4
),
'gt_boxes'
),
tf
.
placeholder
(
tf
.
int64
,
(
None
,),
'gt_labels'
)]
# all > 0
if
config
.
MODE_MASK
:
ret
.
append
(
tf
.
placeholder
(
tf
.
uint8
,
(
None
,
None
,
None
),
'gt_masks'
)
)
# NR_GT x height x width
return
ret
def
preprocess
(
self
,
image
):
image
=
tf
.
expand_dims
(
image
,
0
)
image
=
image_preprocess
(
image
,
bgr
=
True
)
...
...
@@ -176,6 +163,19 @@ class DetectionModel(ModelDesc):
class
ResNetC4Model
(
DetectionModel
):
def
inputs
(
self
):
ret
=
[
tf
.
placeholder
(
tf
.
float32
,
(
None
,
None
,
3
),
'image'
),
tf
.
placeholder
(
tf
.
int32
,
(
None
,
None
,
config
.
NUM_ANCHOR
),
'anchor_labels'
),
tf
.
placeholder
(
tf
.
float32
,
(
None
,
None
,
config
.
NUM_ANCHOR
,
4
),
'anchor_boxes'
),
tf
.
placeholder
(
tf
.
float32
,
(
None
,
4
),
'gt_boxes'
),
tf
.
placeholder
(
tf
.
int64
,
(
None
,),
'gt_labels'
)]
# all > 0
if
config
.
MODE_MASK
:
ret
.
append
(
tf
.
placeholder
(
tf
.
uint8
,
(
None
,
None
,
None
),
'gt_masks'
)
)
# NR_GT x height x width
return
ret
def
build_graph
(
self
,
*
inputs
):
is_training
=
get_current_tower_context
()
.
is_training
if
config
.
MODE_MASK
:
...
...
@@ -256,11 +256,10 @@ class ResNetC4Model(DetectionModel):
mask_logits
=
maskrcnn_upXconv_head
(
'maskrcnn'
,
fg_feature
,
config
.
NUM_CLASS
,
num_convs
=
0
)
# #fg x #cat x 14x14
matched_gt_masks
=
tf
.
gather
(
gt_masks
,
fg_inds_wrt_gt
)
# nfg x H x W
target_masks_for_fg
=
crop_and_resize
(
tf
.
expand_dims
(
matched_
gt_masks
,
1
),
tf
.
expand_dims
(
gt_masks
,
1
),
fg_sampled_boxes
,
tf
.
range
(
tf
.
size
(
fg_inds_wrt_gt
))
,
14
,
fg_inds_wrt_gt
,
14
,
pad_border
=
False
)
# nfg x 1x14x14
target_masks_for_fg
=
tf
.
squeeze
(
target_masks_for_fg
,
1
,
'sampled_fg_mask_targets'
)
mrcnn_loss
=
maskrcnn_loss
(
mask_logits
,
fg_labels
,
target_masks_for_fg
)
...
...
@@ -408,11 +407,10 @@ class ResNetFPNModel(DetectionModel):
mask_logits
=
maskrcnn_upXconv_head
(
'maskrcnn'
,
roi_feature_maskrcnn
,
config
.
NUM_CLASS
,
4
)
# #fg x #cat x 28 x 28
matched_gt_masks
=
tf
.
gather
(
gt_masks
,
fg_inds_wrt_gt
)
# fg x H x W
target_masks_for_fg
=
crop_and_resize
(
tf
.
expand_dims
(
matched_
gt_masks
,
1
),
tf
.
expand_dims
(
gt_masks
,
1
),
fg_sampled_boxes
,
tf
.
range
(
tf
.
size
(
fg_inds_wrt_gt
))
,
28
,
fg_inds_wrt_gt
,
28
,
pad_border
=
False
)
# fg x 1x28x28
target_masks_for_fg
=
tf
.
squeeze
(
target_masks_for_fg
,
1
,
'sampled_fg_mask_targets'
)
mrcnn_loss
=
maskrcnn_loss
(
mask_logits
,
fg_labels
,
target_masks_for_fg
)
...
...
tensorpack/train/trainers.py
View file @
9383740f
...
...
@@ -38,7 +38,7 @@ __all__ = ['SimpleTrainer',
def
_int_to_range
(
x
):
if
isinstance
(
x
,
int
):
assert
x
>
0
,
x
assert
x
>
0
,
"Argument cannot be {}!"
.
format
(
x
)
return
list
(
range
(
x
))
return
x
...
...
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