How can i Speed up the training Faster RCNN

4 views (last 30 days)
faisal alamri
faisal alamri on 20 Oct 2017
Answered: Kenta on 31 Mar 2020
Hi everyone,
Thank you for taking the time to help.
I am running Faster RCNN https://uk.mathworks.com/help/vision/examples/object-detection-using-faster-r-cnn-deep-learning.html, on my own dataset, but it is taking ages to do the training (even though I am using a very powerful machine with gpu)
I am trying to train 4 classes on 5000 training images.
Can anyone help me on how can I do the training process faster? Can I use a pre-trained model, I have searched for a pre-trained model, but didn’t find any (or may be I did not know whether the found ones are suitable).
Please if you suggest any pre-trained model, instruct me on how to use it.
Thank you again.
  1 Comment
Rana Alaqil
Rana Alaqil on 30 Jan 2020
Hello Fisal,
I'm working on the same model but I haven't been able to make it work on my dataset. Could you please provide me with the code that preprocess the data so it can be passed smoothly to the network?
I checked my dataset and it looks exactly the same as the Vehicle dataset but I'm still stuck at this error message:
Error using vision.internal.cnn.validation.checkGroundTruthDatastore>iCheckBoxes (line 87)
The bounding box (2nd column) from the read method output of the training input datastore must be an M-by-1 cell
array, containing elements of N-by-4 double matrix, where N equals the number of boxes in an image.
Error in vision.internal.cnn.validation.checkGroundTruthDatastore (line 46)
mSize = iCheckBoxes(boxes);
Error in trainFasterRCNNObjectDetector>iParseInputs (line 997)
params.ClassNames = vision.internal.cnn.validation.checkGroundTruthDatastore(trainingDs);
Error in trainFasterRCNNObjectDetector (line 399)
[trainingData, options, params] = iParseInputs(...
Error in ResNet (line 141)
[detector, info] = trainFasterRCNNObjectDetector(trainingData,lgraph,options, ...
Caused by:
Error using checkGroundTruthDatastore
Expected input number 2, Boxes in read output of training datastore input, to be nonempty.
where line 141 is:
[detector, info] = trainFasterRCNNObjectDetector(trainingData,lgraph,options, ...
'NegativeOverlapRange',[0 0.3], ...
'PositiveOverlapRange',[0.6 1]);
Please let me know if you have any idea how to overcome this problem.
Thanks a lot!

Sign in to comment.

Answers (4)

Amy
Amy on 25 Oct 2017
Hi Faisal,
There is a pre-trained network for vehicle detection that is part of the Automated Driving System Toolbox, see vehicleDetectorFasterRCNN.
Besides that, MATLAB does not provide any pre-trained Faster R-CNN object detectors.
There is also a pre-trained AlexNet which could be used to create an R-CNN model for object detection.
  7 Comments
taha khan
taha khan on 2 May 2018
WEI LI HU hi ? Sir when I am retaining AlexNet my training speed is become slow ? How to train fast ? Any technique ?

Sign in to comment.


taha khan
taha khan on 2 May 2018
Amy MacDonough hi ma'am ? I am useing AlexNet ? For prefect detection and recognization I have retrain Alexnet ? According this way https://blogs.mathworks.com/pick/2017/02/24/deep-learning-transfer-learning-in-10-lines-of-matlab-code/ But my training is not working ? It stop on 1 step of traing and too much slow ? How to fix it ?

Divas Bahuguna
Divas Bahuguna on 7 Sep 2018
I am currently using AlexNet for Faster-RCNN as well and have observed that scaling the input image by an appropriate factor results in better detection with somewhat accurate bounding box in my case. The object I am trying to detect is not more than (64 64) pixels in the image of target resolution (720x480). Since images I used for training Alex Net(ground truth) are 227x227 sized target object making up the entire training image, I am using this scaling factor of 227/64 to scale the final test images. This ensures objects in my final target image set are scaled appropriately so as to fit into minimum 227x227 detection window for which the RCNN was trained. Naturally, I observe reduction in quality with pixelated final images, but with sufficiently large training set of multi-resolution images I am able to achieve performance suitable for my use. Hope this helps.

Kenta
Kenta on 31 Mar 2020
As of 2020a, algorithms for object detection have been updated. For example, SSD (Single Shot Detector), YOLO v2 and YOLO v3 are available. You can use a pre-trained network like ResNet 50 for feature extraction. The use of pre-trained model will improve your work a lot. Besides, other advantages of them are the processing speed in inference.
Please search on web and you can easily find them. The below is a link for SSD. Hope it helps you.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!