Question About NPU detect with yolo-v4

Hello.

I’m using VIM3 with yolo v4 model to detect object at video stream.

Converting and Detecting at VIM3 is not problem.

But I discovered a very strange phenomenon.

In my logic, I give the time interval between frames before detect.

For example, If time interval is 300ms

Detect one frame and detect the next frame 300ms later.

If I give the interval more than 500ms, Delays occur intermittently in detection time.
( If it is less than 500ms, the phenomenon does not occur.)

And It is constant around 8400ms.(In general, around 170ms)

This is part of the source code.


long long startTime = checkTime(); (ms)

int ret = det_get_result(%result, DET_YOLO_V4);

long long endTime = checkTime(); (ms)

detection time = entTime - startTime;


Can you tell me what causes this phenomenon?

Thnak you

Hello @rrsd0613

@Louis-Cheng-Liu will help you then.

Hello @rrsd0613

Sorry, I do not understand what you mean. On my VIM3, YOLOv4 detect one frame spend about 160ms. Giving 500ms sleep, spend about 660ms a frame. There is nothing abnormal.

Or is i misunderstand your mean?

Hello @Louis-Cheng-Liu

First, Thank you for your reply.

I will explain further.

In My Case, I am detecting frame repeatedly with time interval.

Like This


detect frame
wait interval
detect frame
wait interval
detect frame
wait interval
and repeat


When I check detect frame time, 160-170ms is measured like you(In most cases)

However, sometimes one frame detection time is measured to be around 8400ms.(If I give the interval more than 500ms)

Like This


detect frame ---- 170ms
wait interval ---- 500ms
detect frame ---- 170ms
wait interval ---- 500ms
detect frame ---- 8400ms
wait tnerval ----500ms
detect frame ---- 170ms
wait interval ---- 500ms
detect frame ---- 170ms
wait interval ---- 500ms
detect frame ---- 170ms
wait interval ---- 500ms
and repeat


I don’t know if you understand. If you have any questions, please tell me.

Thank you.

Hello @rrsd0613 ,

According to your description, i add test codes.

gettimeofday(&time_start, 0);
ret = det_get_result(&resultData, g_model_type);
if (ret) {
	cout << "det_get_result fail. ret=" << ret << endl;
	det_release_model(g_model_type);
	goto out;
}
usleep(500000);
gettimeofday(&time_end, 0);
float time = (float)((time_end.tv_sec - time_start.tv_sec) * 1000.0f + (time_end.tv_usec - time_start.tv_usec) / 1000.0f);
printf("%f\n ms", time);

I have run more than 5 hours, but it does not occur phenomenon you say. All detection time is about 660ms(160+500).

What is your power source you use? Power source should be 12V/2A. If lower than this or use PC as power source, VIM3 can not work best performance and stability.

Hello @Louis-Cheng-Liu

Thank you for your support.

I will follow your advice and check further.

If I have any further questions, I will contact you.

Thank You !