C言語のDLLにyolov4の物体検出モデルをロードする方法
9 views (last 30 days)
Show older comments
function [bboxes, scores, labels, annotatedImage] = yolov4Detect(imageData)
% コード生成対応モデルの読み込み
persistent yolov4Detector;
if isempty(yolov4Detector)
yolov4Detector = coder.loadDeepLearningNetwork("yolov4Detector.mat");
end
% 固定サイズの設定
height = 224; % YOLOv4が使用する高さ
width = 224; % YOLOv4が使用する幅
numChannels = 3; % RGB画像の場合のチャンネル数
% 画像データを再構築
I = reshape(imageData, [height, width, numChannels]);
% 物体検出
[bboxes, scores, labels] = detect(yolov4Detector, I);
% 画像に検出結果を描画
if ~isempty(bboxes)
% バウンディングボックスとラベルを描画
annotatedImage = insertObjectAnnotation(I, 'rectangle', bboxes, labels);
else
% 検出結果がない場合はそのまま返す
annotatedImage = I;
end
end
//
5行目
yolov4Detector = coder.loadDeepLearningNetwork("yolov4Detector.mat");
に対してエラーが発生しました。
The full file path to MAT file or function name 'yolov4Detector.mat' contains unsupported non ASCII characters. For code generation, the full file path must contain ASCII characters only.
どうすれば良いですか
0 Comments
Answers (1)
Image Analyst
on 16 Oct 2024
Seems like it's saying it doesn't like some of the characters in your path. Your current folder probably has an unsupported character in it. Try using a path with all Western/Latin/English letters in it.
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!