mediapipe_face_iris_cpp icon indicating copy to clipboard operation
mediapipe_face_iris_cpp copied to clipboard

Change resolution

Open jly0810 opened this issue 2 years ago • 4 comments

When I use the following statement to change the resolution of the camera (changing the resolution from the default 640 * 480 to 1280 * 720), why does the average frame rate increase instead? cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280); cap.set(CV_CAP_PROP_FRAME_HEIGHT, 720); 1280*720: image

640*480: image

I hope you can answer, thank you!

jly0810 avatar Mar 15 '22 07:03 jly0810

Did you try cv::VideoCapture cap(0, cv::CAP_DSHOW)? Btw, the inference time in my code does not include the time opencv captures a frame because it is limited by your camera's FPS.

pntt3011 avatar Mar 15 '22 12:03 pntt3011

你试过了cv::VideoCapture cap(0, cv::CAP_DSHOW)吗?顺便说一句,我的代码中的推理时间不包括 opencv 捕获帧的时间,因为它受到相机 FPS 的限制。

Thank you for your reply! I think the reason for the above problem is that FPS in your code does not include the time of capturing frames. If I want to record the complete time to get FPS, I put the amount of time "start" before the "cap. Read" function. Is this correct? 以下是我更改后的测试结果 image image These results seem right.

In addition, I have another question that has not been solved. I hope you can answer it. I can run your code in the release mode of VS, but an error will be reported in the debug mode. What is the reason? Operation results:

image

Debugging results:

image

jly0810 avatar Mar 15 '22 13:03 jly0810

I think your FPS measurement is absolutely correct. About the error in debug mode, I also faced it before but couldn't fix it (I vaguely remembered it was tflite's problem). That was one of the reasons I decided to use CMake instead because of its "Release with Debug info" mode. I'm sorry I couldn't be of more help.

pntt3011 avatar Mar 15 '22 14:03 pntt3011

I tried moving tflite::ops::builtin::BuiltinOpResolver resolver to the ModelLoader class instead of using as a local variable and the above error was solved. But then m_interpreter->inputs() raised another error. All examples I have seen just hardcode the tensor index.

pntt3011 avatar Mar 17 '22 11:03 pntt3011