Simulink Android Object Detection Issue
Mostra commenti meno recenti
Hello everyone. I am having a problem with simulink android app. I want to detect objects on phone camera and display them with information like category and score. I open Simulink / Simulink Support Package for Android Devices / Deep Learning and replace the function with this;
function y = fcn(u)
persistent detector;
if isempty(detector)
detector = coder.loadDeepLearningNetwork('darknet53.mat');
end
[bbox,score,label] = detect(detector,u);
for i = 1 : size(bbox, 1)
annotation = sprintf('%%%.2f %s', score(i)*100, label(i));
u = insertObjectAnnotation(u, 'rectangle', bbox(i,:), annotation);
end
y = u;
Also in darknet53.mat;
darknet53=yolov4ObjectDetector("csp-darknet53-coco");
When I try to build,deploy&start on my mobile device, the following error appears;
=== Build (Elapsed: 1:51 min) ===
### Starting build procedure for: untitled
Error:Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
Error:An input argument with type 'categorical' is inconsistent with the conversion character 's' in the 'formatSpec'. For code generation, the type of this input argument must be 'char' or 'string'.
Function 'Subsystem/MATLAB Function' (#32.232.276), line 12, column 18:
"sprintf('%%%.2f %s', score(i)*100, label(i))"
Launch diagnostic report.
Error:Undefined function or variable 'annotation'. The first assignment to a local variable determines its class.
Function 'Subsystem/MATLAB Function' (#32.336.346), line 13, column 59:
"annotation"
Launch diagnostic report.
Error:Errors occurred during parsing of MATLAB function 'untitled/Subsystem/MATLAB Function'
Error:Simulink cannot determine sizes and/or types of the outputs for block 'untitled/Subsystem/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
### Build procedure for untitled aborted due to an error.
Top model targets built:
Model Action Rebuild Reason
====================================================================
untitled Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 1m 51.158s
Error:Simulink cannot determine sizes and/or types of the outputs for block 'untitled/Subsystem/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Error:An error occurred while propagating data type 'uint8' through 'untitled/Subsystem/MATLAB Function'.
I'm not familiar with Simulink, I made something that works on Windows and I want to port it to my Xiaomi Redmi Note 7 / Android 10.
Risposte (0)
Categorie
Scopri di più su Modeling in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!