How can i Speed up the training Faster RCNN
Afficher commentaires plus anciens
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 commentaire
Rana Alaqil
le 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!
Réponses (4)
Amy
le 25 Oct 2017
2 votes
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 commentaires
faisal alamri
le 25 Oct 2017
Modifié(e) : Walter Roberson
le 25 Oct 2017
Konstantin Beckmann
le 9 Mar 2018
Hello Faisal,
could you solve the time problem while training the r-cnn (r-cnn builded from scratch). I have the same problem: It takes ages to train the r-cnn presented in https://de.mathworks.com/help/vision/examples/object-detection-using-faster-r-cnn-deep-learning.html with my own data. Furthermore the gpu is underutilized although I set
'ExecutionEnvironment','gpu'
in the options.
Could you successfully implement Alexnet for a pre-trained faster r-cnn? Have you changed only the last 3 layers or have you modified anything else (for example the imput layer)?
Thank you for a quick response.
WEI LI HU
le 9 Mar 2018
Alexnet with a pre-trained faster r-cnn by changed only the last 3 layers modified work fine for mine. No input layer modified. But the box detetor accuracy is quite bad. is it because I use only 30 image per class? (i have 3 classes)
Konstantin Beckmann
le 13 Mar 2018
In the demo: https://de.mathworks.com/help/vision/examples/object-detection-using-faster-r-cnn-deep-learning.html it says that:
"For classification tasks, the input size is typically the size of the training images. For detection tasks, the CNN needs to analyze smaller sections of the image, so the input size must be similar in size to the smallest object in the data set"
The AlexNet input layer is [227 277 3]. Are your objects in your images around that size? The objects in my images are smaller therefore I need to modify the input layer of AlexNet. Is that just possible or is it a problem due to the structure of AlexNet?
The other problem ist still the time problem while training (6000 images, 1 class (detect object from background)). For some reasen the gpu is not used, although I have set this in the options. Does anyone have a solution?
WEI LI HU
le 14 Mar 2018
oh yes actually my object size in my image are around 20~227 pixel size. that why my RCNN (alex-net, no modify input layers) works bad. however, how to modify pre-trained input layers by my own??
taha khan
le 2 Mai 2018
WEI LI HU hi ? Sir when I am retaining AlexNet my training speed is become slow ? How to train fast ? Any technique ?
Serge Mooyman
le 9 Août 2019
Maybe increase the learning rate?
taha khan
le 2 Mai 2018
1 vote
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
le 7 Sep 2018
1 vote
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
le 31 Mar 2020
1 vote
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.
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!