Now I get succeed to compile yolov5m model to with/without nms, and get correct detection results when I use the sample code with API pair:
hailo_vstream_write_raw_buffer(…) and hailo_vstream_read_raw_buffer(…).
I also get correct detection with yolov5m with nms with API:
hailo_infer(…).
Now my problem is that I cannot get correct detection results with API hailo_infer(…) of yolov5m without nms. I can invoke the function correctly, and get 3 layers of output data, but the detection results is wrong.
I compared the 3 output streams between hailo_infer() and hailo_vstream_write_raw_buffer(…), hailo_vstream_read_raw_buffer(…) on same yolov5m.hef, they are different. I post the code here, can you please help me to figure it out?
hailo_status status = HAILO_UNINITIALIZED;
hailo_stream_raw_buffer_by_name_t input_buffer = { 0 };
hailo_stream_raw_buffer_by_name_t output_buffer[3];
_output_data.resize(3);
vector<vector<uint8_t>> output_data2(3);
hailo_stream_raw_buffer_by_name_t output_buffer2[3];
size_t frame_size = 0;
for (size_t i = 0; i < vstreams_infos_size; i++)
{
if (HAILO_H2D_STREAM == vstreams_infos[i].direction)
{
memcpy(input_buffer.name, vstreams_infos[i].name, HAILO_MAX_STREAM_NAME_SIZE);
status = hailo_get_vstream_frame_size(&(vstreams_infos[i]), &(vstreams_infos[i].format), &frame_size);
//status = hailo_get_input_vstream_frame_size(input_vstreams[i], &input_frame_sizes[i]);
if (status != HAILO_SUCCESS)
{
return status;
}
input_buffer.raw_buffer.size = frame_size * INFER_FRAME_COUNT;
input_buffer.raw_buffer.buffer = _im.data;
}
else
{
size_t output_size;
memcpy(output_buffer[3-i].name, vstreams_infos[i].name, HAILO_MAX_STREAM_NAME_SIZE);
status = hailo_get_vstream_frame_size(&(vstreams_infos[i]), &(vstreams_infos[i].format), &output_size);
if (status != HAILO_SUCCESS)
{
return status;
}
_output_data[3 - i].resize(output_size * INFER_FRAME_COUNT);
output_buffer[3 - i].raw_buffer.size = (output_size * INFER_FRAME_COUNT);
output_buffer[3 - i].raw_buffer.buffer = _output_data[3 - i].data();
}
}
size_t frames_count = INFER_FRAME_COUNT;
status = hailo_infer(network_group,
input_vstream_params, &input_buffer, 1,
output_vstream_params, output_buffer, 3,
frames_count);