- detect function for YOLOv3 network (look at expected data type for images) - https://www.mathworks.com/help/vision/ref/yolov3objectdetector.detect.html
- detect function for RCNN network (look at expected data type for images) - https://www.mathworks.com/help/vision/ref/rcnnobjectdetector.detect.html
- evaluateObjectDetection - https://www.mathworks.com/help/vision/ref/evaluateobjectdetection.html
How to evaluate Trained detector on test dataset?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
How can I evaluate Trained detector on test dataset, pelase? Here example code:
tic
detectionResults = detect(Trained_detector, testData, 'MiniBatchSize', 50);
% Evaluate the object detector using average precision metric.
[ap,recall,precision] = evaluateDetectionPrecision(detectionResults, testData);
classID = 1;
figure
plot(recall{classID},precision{classID},'LineWidth',4)
xlabel("recall")
ylabel("accuracy")
grid on
title(sprintf("AP = %.3f",ap(classID)))
toc
Here Error:
Expected I to be one of these types:
double, single, int16, uint16, uint8, logical
Instead its type was matlab.io.datastore.CombinedDatastore.
댓글 수: 0
채택된 답변
T.Nikhil kumar
2024년 5월 14일
Hello Drov,
I understand that you are trying to test a detector network on a custom dataset using the ‘detect’ function.
The error message suggests that the ‘detect function’ is expecting images of certain types (e.g., double, single, int16, uint16, uint8, logical), but instead, it received an object of type ‘CombinedDatastore’.
The format of test data argument for ‘detect’ function depends on the type of your trained network. I assume you are using a R-CNN deep learning detector. The ‘detect’ function expects the test data to be a numeric array of images (H-by-W-by-C). You will need to convert the test data from a combined datastore to the required array.
For using the ‘detect’ function, I suggest you to first extract the image data from the ‘combinedDatastore’ object and then detect bounding boxes for each image. You can also accumulate results while doing so. Here is a sample code snippet for the process:
% Read all the data from the combined datsstore
allData = readall(testData);
% Extract the images data
imagesData = allData(:,1);
% preallocate detectionResults
detectionResults = zeros(size(imagesData));
% Loop through the images and store detection results
for i = 1:size(imagesData,1)
imageDetectionResult = detect(Trained_detector, imagesData{i});
detectionResults = [detectionResults imageDetectionResult];
end
For evaluating the performance, you can use ‘evaluateObjectDetection’ function. You can use the combinedDatastore object itself with this function.
Refer to the following documentation for more understanding about:
Hope this helps you proceed with your work!
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!