- 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 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Drov
el 12 de Mayo de 2024
Comentada: Drov
el 17 de Mayo de 2024
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 comentarios
Respuesta aceptada
T.Nikhil kumar
el 14 de Mayo de 2024
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!
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!