mitmul / chainer-faster-rcnn Goto Github PK
View Code? Open in Web Editor NEWObject Detection with Faster R-CNN in Chainer
License: MIT License
Object Detection with Faster R-CNN in Chainer
License: MIT License
This is not an issue, but a solution.
For issues with cpu and gpu nms, please refer to:
https://github.com/MrGF/py-faster-rcnn-windows/tree/master/lib
Hi,
I am running Chainer and this algorithm on an Ubuntu 16.04 environment on a GTX 970. It seems fine running with CPU, but with my GPU, I get the following errors:
Traceback (most recent call last): File "forward.py", line 106, in <module> cls_score, bbox_pred = model(img, np.array([[h, w, im_scale]])) File "/home/cammy/repositories/cammy-skynet-benchmarking/faster-rcnn/lib/models/faster_rcnn.py", line 41, in __call__ h, n = self.trunk(x), x.data.shape[0] File "/home/cammy/repositories/cammy-skynet-benchmarking/faster-rcnn/lib/models/VGG16.py", line 56, in __call__ x = (getattr(self, name) if 'conv' in name else f)(x) File "/usr/local/lib/python2.7/dist-packages/chainer/links/connection/convolution_2d.py", line 101, in __call__ x, self.W, self.b, self.stride, self.pad, self.use_cudnn) File "/usr/local/lib/python2.7/dist-packages/chainer/functions/connection/convolution_2d.py", line 318, in convolution_2d return func(x, W, b) File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 198, in __call__ outputs = self.forward(in_data) File "/usr/local/lib/python2.7/dist-packages/chainer/function.py", line 310, in forward return self.forward_gpu(inputs) File "/usr/local/lib/python2.7/dist-packages/chainer/functions/connection/convolution_2d.py", line 103, in forward_gpu (self.ph, self.pw), (self.sy, self.sx), x.dtype) File "/usr/local/lib/python2.7/dist-packages/cupy/cudnn.py", line 101, in create_convolution_descriptor desc.value, pad[0], pad[1], stride[0], stride[1], 1, 1, mode) File "cupy/cuda/cudnn.pyx", line 348, in cupy.cuda.cudnn.setConvolution2dDescriptor (cupy/cuda/cudnn.cpp:3986) TypeError: an integer is required
Is there some problem in the code passing values into the convolutional layer? Thanks!
Hi Saito,
Is it possible to share the code convert py-faster-rcnn caffe model to chainner model?
thank you in advance!
Hi,
I was trying the latest version as of Nov 17 2016.
When I ran forward.py in a CPU only environement, the following error was encountered:
File "forward.py", line 89, in
cls_score, bbox_pred = model(img, np.array([[h, w, im_scale]]))
File "....lib/models/faster_rcnn.py", line 46, in call
if isinstance(im_info, chainer.cuda.cupy.ndarray):
AttributeError: 'module' object has no attribute 'cupy'
Are there any changes needed for it to run in without GPU?
Thanks!
cloudtoro
It's really beautiful workflow diagram, in the Feature maps(N, 512, H/4, W/4), i am feel confused that after four pooling layer in VGG network, it's height(width) may be H/(2^4) = H/16?
It seems 32gb cpu memory and 4gb gpu memory is not enough. Is there a hardware requirement for running it?
Hi,
I am confused as to where do the bbox_deltas come from in the workflow diagram? RPN predicts x,y,height,weight along with probability of the ROI being an object. I have seen these being used for anchor target layer as well. I think i am missing something here
Any help would be appreciated
Thank you!
Hi @mitmul. I'm testing this program in Windows 10 64-bits (Anaconda + Pycharm), following your instructions.
The first error I found was in the file cpu_nms.pyx, line 26: cdef np.ndarray[np.int_t, ndim=1] order = scores.argsort()[::-1]
, where the error was ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long'
. This can be fixed by replacing int_t
with int64_t
(in a similar way as suggested in rbgirshick/py-faster-rcnn#36).
After fixing that error, I get another error in the file bbox_transform.py, line 73, in _bbox_transform_inv:
pred_boxes[:, 0::4] = pred_ctr_x - 0.5 * pred_w
ValueError: could not broadcast input array from shape (300,21) into shape (1,21)
I'm stuck with this. Any suggestion?
Hi,
thanks for the code. I have a question regarding loss functions. It seems that you have implemented your own ParallelUpdater class to deal with multiple output losses of the r-cnn network (two for rpn and two for final classification and bbox regression).
What I don't understand is the reason for updating each loss individually. Doesn't this mean that the gradients of especially the lower layers (trunk etc.) are re-computed four times for each example, each time with different incoming upper gradient depending on the current loss branch? To me this seems very inefficient. When I modify the FasterRCNN class training-mode output to be a sum of the four losses, not a 4-tuple, and use the chainer's ParallelUpdater
, it speeds up the training about 3x by experiments on GTX970, and I also do not get initial exp overflows in the beginning of the training.
Shouldn't there be a single combined loss defined as the sum of the four losses? This certainly is the case in the original(ish) tensorflow implementation
Is it possible to get VGG16.model for training? I want to train the object detector but cannot prepare the nvidia-docker because I do not have root privilege in my GPU environment.
In docker/install_caffe_docker.sh, "cd caffe/docker; make cpu_standalone" (L33).
But, In docker/Dockerfile, "FROM caffe:gpu" (L1).
Mismatch docker image of caffe:cpu and caffe:gpu.
https://dl.dropboxusercontent.com/u/2498135/faster-rcnn/VGG16_faster_rcnn_final.model?dl=1
This lins's model is not found.
Hi, i was wondering if you could provide some information how to retrain the model, or provide some links to how to setup this myself.
Hello ,
When I try to run the setup it gives me error of not getting found
/cuda/lib/nvcc
When I install the CUDA toolkit it gets stuck in the login loop.
I have tried to install in 2 ubuntu system with versions 14.04 and 16.04.
And getting the same kind of issue in both systems.
I have followed these steps to install,
https://askubuntu.com/questions/799184/how-can-i-install-cuda-on-ubuntu-16-04
Please help me on how to do that.
Hello,
I looked a bit into your code because I wanted to train on another dataset just to try it out and see how Chainer's Faster-RCNN version works compared to the original one.
To me it seems that your training cycle is different from the cycle that the original implementation uses.
More specifically: You go through all images and then you create an object in your database for every object in the image. You don't build up a matrix like is the case in the python-caffe implementation. Doing the training image-wise would save much computation time since you would not have to backpropagate the same image for every single object in the image. Instead you would propagate once, learn the bbox and cls regression and go on to the next image. Regarding PASCAL VOC the difference might be not big since most images contain only one object. But thinking of Datasets that have like 10 objects per image, I that you could be at least around 8times faster by changing the training.
Or am I doing a misinterpretation here? In that case I would like to understand the code a bit better and it would be great if you would point me to the important parts of the code where you merge objects and images again for training.
Thanks for this great code - I quite enjoyed working with it since it's very readable thanks to Chainers clean style.
Best regards and thanks
Manuel
Hi! Thanks a lot for doing this! How would i go about training the model on my own dataset?
いつも参考にさせて頂いております。
chainer-faster-rcnnの再学習に挑戦していたところ、
モデルデータの読み込みでエラーが発生しました
Tracebask (most recent call last):
File "train.py", line 37, in
args.trunk_file, args.trunk_name, args.trunk_param, True, result_dir)
File "****/chainer-faster-rcnn/utils/prepare_train.py", line 185, in get_model
for trunk_name in trunk.leys():
AttributeError: 'CaffeFunction' object has no attribute 'keys'
モデルデータは下記を参考にVGG16.modelを作成
#15
モデルデータのサイズは下記の通りです
入力:VGG_ILSVRV_16_layers.caffemodel 553,432,081byte
出力:VGG16.model 3,778,049,090byte
エラーの原因に心当たりありましたら、ご教示いただけないでしょうか?
また、モデルデータのサイズは妥当でしょうか?
■テスト環境
ubuntu 14.04LTS
python 2.7.6
chainer 1.21.0
numpy 1.12.0
protobuf 3.2.0
pycuda 2016.1.1
CUDA 8.0
How to fine tune your model?
I don't have sufficient data to retrain your model from scratch.
I want to fine tune your model on my data which has only two classes ?
Chainer can support multiple gpus training (in a single machine).
Does this version of faster-rcnn support multi-gpu?
When I try to train with provided file 'training_rpn.py', it occurs ValueError : batch is empty.
The line 181 : train_mode(updater, 'rcnn', 10, 10, 10, 40) makes this error. Why batch is empty?
Anyone knows what's problem? I didn't modified anything and forward.py works gracefully.
(I also using gpu mode with single gpu)
Hi,
I am running Chainer and this algorithm on an Ubuntu 14.04 environment on a GTX 1080.
I tried object detection using images of several resolutions.
In an image close to a square, objects could be detected correctly,but if the image is horizontally long(e.g.1359x699), it did not detect the object on the right side.
Is there something wrong with internal processing? (Image size reduction processing, etc.)
Sincerely,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.