Giter Club home page Giter Club logo

fasterrcnn-pytorch's Introduction

FasterRCNN-pytorch

FasterRCNN is implemented in VGG, ResNet and FPN base.

reference:

rbg's FasterRCNN code: https://github.com/rbgirshick/py-faster-rcnn


Model Performance

Train on VOC2017 Test on VOC2017

Backbone mAp
VGG16 0.7061
ResNet101 0.754

Train Your Model

1.Before Run You Need:

  1. cd ./lib

    Change gpu_id in make.sh and setup.py.
    Detially, you need modify parameter setting in line 5, 12 and 19 in make.sh and line 143 in setup.py where include key words '-arch=' depend on your gpu model.(select appropriate architecture described in table below)

    sh make.sh

    GPU model Architecture
    TitanX (Maxwell/Pascal) sm_52
    GTX 960M sm_50
    GTX 108 (Ti) sm_61    
    Grid K520 (AWS g2.2xlarge)   sm_30    
    Tesla K80 (AWS p2.xlarge)   sm_37    
  2. cd ../

    mkdir ./data

    mkdir ./data/pretrained_model

    download pre-trained weights in ./data/pretrained_model

  3. run train.py

2.How to use?

Note: decentralization in preprocesing is based on BGR channels, so you must guarantee your pre-trained model is trained on the same channel set if you use transfer learning

For example:

VGG: CUDA_VISIBLE_DEVICES=1 python train.py --net='vgg16' --tag=vgg16 --iters=70000 --cfg='./experiments/cfgs/vgg16.yml' --weight='./data/pretrained_model/vgg16_caffe.pth'

CUDA_VISIBLE_DEVICES=2 python test.py --net='vgg16' --tag=vgg16 --model=60000 --cfg='./experiments/cfgs/vgg16.yml' --model_path='voc_2007_trainval/vgg16/vgg16_faster_rcnn' --imdb='voc_2007_test' --comp

ResNet:

CUDA_VISIBLE_DEVICES=2 python train.py --net='res18' --tag=res18 --iters=70000 --cfg='./experiments/cfgs/res18.yml' --weight='./data/pretrained_model/Resnet18_imagenet.pth'

CUDA_VISIBLE_DEVICES=3 python train.py --net='res50' --tag=res50 --iters=70000 --cfg='./experiments/cfgs/res50.yml' --weight='./data/pretrained_model/Resnet50_imagenet.pth'

CUDA_VISIBLE_DEVICES=7 python train.py --net='res101' --tag=res101 --iters=80000 --cfg='./experiments/cfgs/res101.yml' --weight='./data/pretrained_model/resnet101_caffe.pth'

CUDA_VISIBLE_DEVICES=6 python test.py --net='res101' --tag=res101_1 --cfg='./experiments/cfgs/res101.yml' --model=70000 --model_path='voc_2007_trainval/res101_1' --imdb='voc_2007_test' --comp


fasterrcnn-pytorch's People

Contributors

yingxingde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fasterrcnn-pytorch's Issues

权重在哪下载

你好!非常感谢你的分享,请问预训练的权重在哪下载呢

assert rpn_keep.numel() == cfg.TRAIN.RPN_BATCHSIZE

Traceback (most recent call last):
File "train.py", line 169, in
pretrained_model=args.weight, max_iters=args.max_iters)
File "/work/tcxia/codes/FasterRCNN-pytorch/lib/model/train_val.py", line 487, in train_net
sw.train_model(resume, max_iters)
File "/work/tcxia/codes/FasterRCNN-pytorch/lib/model/train_val.py", line 130, in train_model
loss_r, image_r = net.train_operation(blobs, None, image_if=True)
File "/work/tcxia/codes/FasterRCNN-pytorch/lib/nets/network.py", line 334, in train_operation
result_cls_prob, result_bbox_pred, result_rois = self(im_data, im_info, gt_boxes)
File "/work/tcxia/anaconda3/envs/py36_th0.4/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/work/tcxia/codes/FasterRCNN-pytorch/lib/nets/network.py", line 247, in forward
cls_prob, bbox_pred, rois = self._predict(im_data, im_info, gt_boxes)
File "/work/tcxia/codes/FasterRCNN-pytorch/lib/nets/network.py", line 214, in _predict
rois, rpn_scores, features = self._rpn(im_data, im_info, gt_boxes)
File "/work/tcxia/anaconda3/envs/py36_th0.4/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/work/tcxia/codes/FasterRCNN-pytorch/lib/nets/network.py", line 88, in forward
self.cross_entropy, self.loss_box = self._build_loss(rpn_cls_score_reshape, rpn_bbox_score, rpn_data)
File "/work/tcxia/codes/FasterRCNN-pytorch/lib/nets/network.py", line 104, in _build_loss
assert rpn_keep.numel() == cfg.TRAIN.RPN_BATCHSIZE
AssertionError

where is _roi_pooling?

Excuse me,in lib/roi_pooling/_ext/roi_pooling/init.py from ._roi_pooling import lib as _lib, ffi as _ffi .but there don't have module named _roi_pooling. did you miss the upload?

内存溢出

RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-bld/pytorch_1524577177097/work/aten/src/THC/generic/THCStorage.cu:58

question regarding gpu id

can you explain what do you mean by:

change gpu_id in make.sh and setup.py

I could not find gpu_id in make.sh,
Can you please explain a little more

Thanks

About FPN

Hi, have you tested on fpn yet?
tried it with the following command,
python train.py --net='fpn101' --tag=fpn101 --iters=80000 --cfg='./experiments/cfgs/fpn101.yml' --weight='./data/pretrained_model/resnet101_caffe.pth'
but an error occurred.
line 17, in generate_anchors_global ratios=np.array(anchor_ratios), scales=np.array([anchor_scales[index]])) IndexError: list index out of range
It seems like that in the generate_anchor function, although feat_strides were updated to (4, 8, 16, 32, 64), but the anchors were still the same, ie, 8 16 32 .

Also, there seems to be 2 typo in fpn101.yml,
EXP_DIR should be fpn101, SNAPSHOT_PREFIX should be fpn101 I guess?

编译错误

make.sh很难编译,建议新用户不要用这个项目了。白浪费我一天时间,pytorch也要降级,setuptools也要降级。醉了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.