Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
6062 Discussions

Launching the camera for face recognition takes a long time in Windows

W_qicheng
Novice
808 Views

When I run "face_recognition_demo" in Windows, I call the camera with the command -i 0, but it takes about 3 minutes from running the program to starting the camera, I don't know what causes it.

 

The following are the commands used.

python ./face_recognition_demo.py -i 0 -m_fd C:\data\model\face-detection-retail-0004\FP16/face-detection-retail-0004.xml -m_lm C:\data\model\landmarks-regression-retail-0009\FP16/landmarks-regression-retail-0009.xml -m_reid C:\data\model\face-reidentification-retail-0095\FP16/face-reidentification-retail-0095.xml --verbose -fg "C:\data\face_gallery"

 

 

0 Kudos
1 Solution
W_qicheng
Novice
467 Views

Hi Hairul

Thank you for your always attentive reply.

 

I have solved the problem described above and share it with you here.

I added the parameter "cv2.CAP_DSHOW" in the place where CV2 calls the camera.

 

I changed the code in "images_capture.py".

class CameraCapWrapper(ImagesCapture):

    def __init__(self, input, camera_resolution):
        self.cap = cv2.VideoCapture()
        try:
            status = self.cap.open(int(input), cv2.CAP_DSHOW)
            self.cap.set(cv2.CAP_PROP_BUFFERSIZE, 1)
            self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, camera_resolution[0])
            self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, camera_resolution[1])
            self.cap.set(cv2.CAP_PROP_FPS, 30)
            self.cap.set(cv2.CAP_PROP_AUTOFOCUS, 1)
            self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG'))
......

 

 

Regards,

Wu

 

View solution in original post

8 Replies
Hairul_Intel
Moderator
778 Views

Hi W_qicheng,

Thank you for reaching out to us.

 

I've ran the Face Recognition Python Demo with my laptop's webcam. The webcam results opens within seconds and successfully ran the demo.

 

For your information, the results below was using a face gallery that contains only 5 images of Tom Cruise which were labelled Tom-1.jpg, Tom-2.jpg… Tom-5.jpg which amounts to a size of 920 KB. Then, I opened an image of Tom Cruise on my phone and placed it directly in front of the webcam.

 

Here is the command I used:

python ./face_recognition_demo.py -i 0 -m_fd intel\face-detection-retail-0004\FP16/face-detection-retail-0004.xml -m_lm intel\landmarks-regression-retail-0009\FP16/landmarks-regression-retail-0009.xml -m_reid intel\face-reidentification-retail-0095\FP16/face-reidentification-retail-0095.xml --verbose -fg face_tom

 

Here are the results:

demoink.jpgresults.png

 

However, when I used a face gallery dataset of 3000 random face images (3.8 GB) the demo will take 3 minutes before the camera output appears. The command prompt shows "[ INFO ] Building faces database using images from face_gallery" which is due to the demo taking time in building the face gallery database before showing the camera output.

 

Here is the command prompt message when it is building the face gallery:

huge_fg.JPG

 

 

You've mentioned that it takes about 3 minutes from running the program to starting the camera. During that period what is the information stated on your command prompt and what is the file size of your face gallery?

 

 

Regards,

Hairul

 

W_qicheng
Novice
736 Views

Thanks for your reply.

First, to answer your question.

1. There is no prompt during the command run.
2. My face gallery is about 23MB.

 

Now I have tested each of the following 3 webcams.
1. https://www.logitech.com/en-us/products/webcams/c270-hd-webcam.960-000694.html
2. https://www.logitech.com/en-us/products/webcams/c925e-business-webcam.960-001075.html
3. https://www.logitech.com/en-us/products/webcams/brio-4k-hdr-webcam.960-001105.html


The C270 (USB2.0) starts video immediately, the C925e (USB2.0) and Brio (USB3.0) both take about 3 minutes to start video.

If you know the reasons mentioned above please let me know. Thank you very much.

 

Regards

W_qicheng

Hairul_Intel
Moderator
642 Views

Hi W_qicheng,

I've validated the Face Recognition Python Demo using the following webcams:

 

I did not encounter any issue and the cameras start immediately when executing the demo.

 

I've ran the demo using the following Open Model Zoo models:

 

 

Here is the command that I used:

python ./face_recognition_demo.py -i 0 -m_fd intel\face-detection-retail-0004\FP16/face-detection-retail-0004.xml -m_lm intel\landmarks-regression-retail-0009\FP16/landmarks-regression-retail-0009.xml -m_reid intel\face-reidentification-retail-0095\FP16/face-reidentification-retail-0095.xml --verbose -fg face_tom

 

 

For your information, I used a face gallery of 25MB size.

 

Here is the result for Logitech C925E Business Webcam and the device details:

c925e_result.png

c925e_dev.png

 

 

Here is the result for Logitech C615 Webcam and the device details:

c615_result.png

c615_dev.png

 

 

 

Regards,

Hairul

 

W_qicheng
Novice
601 Views

Hi, Hairul

Thanks for your detailed reply.

But I still haven't solved the problem.

 

Here is the hardware I used and the configuration.

画像の貼り付け先_ 2022-3-9 10-32.png

画像の貼り付け先_ 2022-3-9 10-33.png

CPU:  Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz 3.00 GHz

RAM:  8GB

 

 

 

and I have attached a video of me executing the code.

 

Regards,

Wu

 

 

Hairul_Intel
Moderator
530 Views

Hi W_qicheng,

We have validated again the Face Recognition Python Demo using Logitech C925E Business Webcam and can confirm that this issue is not related to OpenVINO. The Logitech C925E camera starts immediately when executing the demo.

 

We'd recommend you to test the cameras on different application or system (if available) and observe whether the issue still persists when using the cameras.

 

From our side, no issues were found when using the Logitech C925E on our system. If the issue still persists, We would suggest you post your query regarding the Logitech C925E video issue in Logitech Community Forum.

 

On another note, there have been reported issues regarding the Logitech C925E Business Webcam and Logitech Brio Ultra HD Pro Business Webcam on different websites. You can refer to the following article and discussions:

 

 

Regards,

Hairul


Hairul_Intel
Moderator
484 Views

Hi W_qicheng,

This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Hairul


W_qicheng
Novice
468 Views

Hi Hairul

Thank you for your always attentive reply.

 

I have solved the problem described above and share it with you here.

I added the parameter "cv2.CAP_DSHOW" in the place where CV2 calls the camera.

 

I changed the code in "images_capture.py".

class CameraCapWrapper(ImagesCapture):

    def __init__(self, input, camera_resolution):
        self.cap = cv2.VideoCapture()
        try:
            status = self.cap.open(int(input), cv2.CAP_DSHOW)
            self.cap.set(cv2.CAP_PROP_BUFFERSIZE, 1)
            self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, camera_resolution[0])
            self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, camera_resolution[1])
            self.cap.set(cv2.CAP_PROP_FPS, 30)
            self.cap.set(cv2.CAP_PROP_AUTOFOCUS, 1)
            self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG'))
......

 

 

Regards,

Wu

 

Hairul_Intel
Moderator
451 Views

Hi Wu,

Thank you for sharing your solution for the benefit of our Community.

 

This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Hairul


Reply