这个是matlab代码对yolov2生成的模型进行测试的代码,他会在图片生成boundingbox.
close all;clear;clc
gpuDevice(1);
load standard_cell2_detector_yolov2_0611_epoch50_changeanchor.mat;
test_image_folder = './predictdata_900_900_crop';
test_output_folder = 'test_cell_detection;
#带有boundingbox的图片测试结果的输出路径
bbox_output_folder = 'cell2_yolov2_bbox_black_white'
test_files = dir(test_image_folder);
length(test_files)
%make output folder
if ~isdir(test_output_folder)
fprintf(1, 'Making directory %s\n', test_output_folder);
mkdir(test_output_folder);
end
if ~isdir(bbox_output_folder)
fprintf(1, 'Making directory %s\n', test_output_folder);
mkdir(bbox_output_folder);
end
for k = 3 : length(test_files)
%for k = 3 : 10
baseFileName = test_files(k).name;
fullFileName = fullfile(test_image_folder, baseFileName);
tic;
I = imread(fullFileName);
[bboxes,scores,labels] = detect(detector,I,'T