Object Detection to Code Generation:

1 view (last 30 days)
Tewodros Mamo
Tewodros Mamo on 15 May 2024
Commented: Tewodros Mamo on 29 May 2024
Hello,
Is Train ACF object detector compatible with code generation? I am seeing some difficulty compiling the detector to download it to a target for a real time application. Any insight would be greatly appreciated. There is a limitted info in help doc but it is only for object detection from an image, even then, the example does not deep dive :)
Thank you.
Best

Answers (1)

Sai Pavan
Sai Pavan on 27 May 2024
Hello,
I understand that you want to know whether the Aggregate Channel Features (ACF) object detector supports code generation so that it can be used for a real-time application on a target. We can train an object detector with the "trainACFObjectDetector" function and use the trained object detector returned as an object for target-specific applications.
The "acfObjectDetector" object indeed has code generation support as mentioned here: https://www.mathworks.com/help/vision/ref/acfobjectdetector.html#:~:text=C/C%2B%2B%20Code%20Generation
Here is the workflow to use the code generation ability of this function:
  • Convert the trained detector object into a structure using the "toStruct" function. Please refer to the below documentation to learn more about "toStruct" function: https://www.mathworks.com/help/vision/ref/acfobjectdetector.tostruct.html
  • Save the structure as MAT file.
  • Generate C-MEX code that you can run in the MATLAB environment using MATLAB Coder.
  • Use the generated C-MEX file to detect objects in a test image.
Please refer to the following example that demonstrates the code generation ability of "acfObjectDetector": https://www.mathworks.com/help/vision/ug/example-ObjectDetectionFromImages.html
Note: You need to have access to MATLAB Coder product to use the code generation capabilities and to generate the C-MEX files.
Hope it helps!
  1 Comment
Tewodros Mamo
Tewodros Mamo on 29 May 2024
Hello Sai,
First of, thank you for your response and the links. However, my application will eventually be integrated to a third party simulink like blocks. I was wondering if a simpler representation of this structures is possible to make this a block or a function that works in simulink or make a matlab function that would then be used in simulink. i.e, A mattrix to insure platform indepenence and portability. like you would represent an adge detector using a 3x3 matrix.
Thank you.
Regards,

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!