TuSimple / simpledet
- четверг, 31 января 2019 г. в 00:18:00
Python
A Simple and Versatile Framework for Object Detection and Instance Recognition
SimpleDet contains a lot of C++ operators not in MXNet offical repo, so one has to build MXNet from scratch. Please refer to INSTALL.md more details
SimpleDet requires groundtruth annotation organized as following format
[
{
"gt_class": (nBox, ),
"gt_bbox": (nBox, 4),
"flipped": bool,
"h": int,
"w": int,
"image_url": str,
"im_id": int,
# this fields are generated on the fly during test
"rec_id": int,
"resize_h": int,
"resize_w": int,
...
},
...
]
Especially, for experimenting on coco datatet, one can organize coco data in
data/
coco/
annotations/
instances_train2014.json
instances_valminusminival2014.json
instances_minival2014.json
image_info_test-dev2017.json
images/
train2014
val2014
test2017
and run the helper script to generate roidb
python3 utils/generate_roidb.py --dataset coco --dataset-split train2014
python3 utils/generate_roidb.py --dataset coco --dataset-split valminusminival2014
python3 utils/generate_roidb.py --dataset coco --dataset-split minival2014
python3 utils/generate_roidb.py --dataset coco --dataset-split test-dev2017
git clone https://github.com/RogerChern/mxnext
# train
python3 detection_train.py --config config/detection_config.py
# test
python3 detection_test.py --config config/detection_config.py
Please refer to MODEL_ZOO.md for available models
detection_train.py
detection_test.py
config/
detection_config.py
core/
detection_input.py
detection_metric.py
detection_module.py
models/
FPN/
tridentnet/
maskrcnn/
cascade_rcnn/
retinanet/
mxnext/
symbol/
builder.py
Everything is configurable from the config file, all the changes should be out of source.
One experiment is a directory in experiments folder with the same name as the config file.
E.g. r50_fixbn_1x.py is the name of a config file
config/
r50_fixbn_1x.py
experiments/
r50_fixbn_1x/
checkpoint.params
log.txt
coco_minival2014_result.json
The models
directory contains SOTA models implemented in SimpletDet.
Simpledet supports many popular detection methods and here we take Faster-RCNN as a typical example to show how a detector is built.
DetectionAugmentation
.
Norm2DImage
and Resize2DImageBbox
.AnchorTarget2D
, which generates anchors and corresponding anchor targets for training RPN.FasterRcnn
. The key components are listed as follow:
Backbone
provides interfaces to build backbone networks, e.g. ResNet and ResNext.Neck
provides interfaces to build complementary feature extraction layers for backbone networks, e.g. FPNConvTopDown
builds Top-down pathway for Feature Pyramid Network.RpnHead
aims to build classification and regression layers to generate proposal outputs for RPN. Meanwhile, it also provides interplace to generate sampled proposals for the subsequent R-CNN.RoiExtractor
extracts features for each roi (proposal) based on the R-CNN features generated by Backbone
and Neck
.BboxHead
builds the R-CNN layers for proposal refinement.The flexibility of simpledet framework makes it easy to build different detectors. We take TridentNet as an example to demonstrate how to build a custom detector simply based on the Faster-RCNN framework.
DetectionAugmentation
.
TridentAnchorTarget2D
is implemented to generate anchors for multiple branches and filter anchors for scale-aware training scheme.Backbone
according to the descriptions in the paper. We also provide a TridentRpnHead
to generate filtered proposals in RPN to implement the scale-aware scheme. Other components are shared the same with original Faster-RCNN.Please refer to DISTRIBUTED.md
Yuntao Chen, Chenxia Han, Yanghao Li, Zehao Huang, Yi Jiang, Naiyan Wang
This project is release under the Apache 2.0 license for non-commercial usage. For commercial usage, please contact us for another license.