@Frank The below is my post processing function.
void post_process_ssd(const char* image_file, float threshold, float* outdata, int num)
{
const char* class_names[] = {“background”, “aeroplane”, “bicycle”, “bird”, “boat”, “bottle”,
“bus”, “car”, “cat”, “chair”, “cow”, “diningtable”,
“dog”, “horse”, “motorbike”, “person”, “pottedplant”, “sheep”,
“sofa”, “train”, “tvmonitor”};
image im = imread(image_file);
int raw_h = im.h;
int raw_w = im.w;
std::vector<Box> boxes;
printf("detect result num: %d \n", num);
for (int i = 0; i < num; i++)
{
if (outdata[1] >= threshold)
{
Box box;
box.class_idx = round(outdata[0]);
box.score = outdata[1];
box.x0 = outdata[2] * raw_w;
box.y0 = outdata[3] * raw_h;
box.x1 = outdata[4] * raw_w;
box.y1 = outdata[5] * raw_h;
boxes.push_back(box);
printf("%s\t:%.2f\n", class_names[box.class_idx], box.score * 100.f);
printf("BOX:( %d , %d ),( %d , %d )\n", ( int )box.x0, ( int )box.y0, ( int )box.x1, ( int )box.y1);
}
outdata += 6;
}
for (int i = 0; i < ( int )boxes.size(); i++)
{
Box box = boxes[i];
draw_box(im, box.x0, box.y0, box.x1, box.y1, 2, 125, 0, 125);
}
save_image(im, "mobilenet_ssd_uint8_out");
free_image (im);
std::cout << "======================================\n";
std::cout << "[DETECTED IMAGE SAVED]:\t"
<< "Mobilenet_SSD"
<< "\n";
std::cout << "======================================\n";
}
Is the post processing right?