MATLAB Answers

GPU Code generation for 'vehicle detector yolov2' in matlab2020a

1 view (last 30 days)
Nithin M
Nithin M on 12 Nov 2020
I was trying to generate GPU cuda code for my program using matlab2020a. Am using detector 'vehicleDetectorYOLOv2()' for generating the vehicle detections and then using another neural network (network generated using 'patternnet') for color detection of detected vehicles.
is there any way I can generate GPU cuda code for vehicleDetectorYOLOv2() & neural network generated using patternnet using GPU coder?
I have found one link: Could someone please suggest whether I should follow the same steps for 'vehicleDetectorYOLOv2()'?
Also any useful information regarding gpu code generation for 'neural network (network generated using 'patternnet')' also most welcome.
Am planning to use the generated CUDA code on a windows machine with installed NVIDIA GPU. any suggestions / adviceor usefull links on this?

Answers (1)

Hariprasad Ravishankar
Hariprasad Ravishankar on 30 Nov 2020
Hi Nithin,
GPU Coder and MATLAB Coder support code generation for detect method of yolov2ObjectDetector in R2020a and therefore also supports the detector object returned by vehicleDetectorYOLOv2 function.
You can follow the steps in the example here to try it out.
The patternnet function however is not supported for code generation. To workaround this limitation, you can create and train a shallow MLP SeriesNetwork object consisting of fullyConnected layers using the trainNetwork function in Deep Learning Toolbox.
Here is an example.
You can then save the trained SeriesNetwork object into a MAT file and generate code for the predict method using MATLAB Coder and GPU Coder.
Here is an example you can follow for generating code for SeriesNetwork and DAGNetwork objects.
Please let me know if this helps.

Community Treasure Hunt

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

Start Hunting!