Just use OpenVINO's named face recognition demo in Docker

I used to run interactive_face_detection_demo, as well as [face_recognition_demo](https://docs.openvinotoolkit.org/2020.3/_demos_python_demos_face_read html) is run. It was a demo that was in OpenVINO 2020.3, but it didn't seem to be in OpenVINO 2020.4. So run it in 2020.3.

output-palette.gif

Run with Docker

It is convenient to set it to 2020.4 or 2020.3, so run it with Docker. (I haven't tried it on Google Colab because it seems to be difficult to operate the GUI.)

X11 server installation

This demo has a function to save the face image on the spot when you enter the name when an unknown face appears. Set the window to be launched from Docker because it is input from the GUI.

This time, I started the X11 server on the host OS (Windows 10) side so that the window of the container (Ubuntu 18) can be blown on Windows 10. Since it is Windows 10, I installed and started 1.20.8.1 of VcXsrv and allowed private network in the Windows firewall settings. The connection address from the docker container to the host OS is not localhost, so check it with ipconfig.

ipconfig
~~~
Ethernet adapter vEthernet(WSL):

Connection-specific DNS suffix. . . . .:
Link-local IPv6 address. . . . .: fe80::6ca1:e659:80eb:a804%18
IPv4 address. . . . . . . . . . . .: 172.25.64.1 (Here is the DISPLAY connection destination)
sub-net mask. . . . . . . . . .: 255.255.240.0
default gateway. . . . . . .:

In the above example, 172.25.64.1 is the DISPLAY connection destination.

Start Docker and run demo

docker run \
  -v /c/Users/${USER}/Downloads:/Downloads \
  -u root \
  -it \
  --rm \
  -e DISPLAY=172.25.64.1:0.0 \
  openvino/ubuntu18_dev:2020.3

The part of 172.25.64.1 is the address confirmed in ↑↑. Since there is no need to add or build a library, it may work even if you are not root, but I wanted to set the model path etc. to same as last time So I'm root. Since it is a demo that is not in 2020.4, we are launching 2020.3.

Work in the container below

${INTEL_CVSDK_DIR}/deployment_tools/tools/model_downloader/downloader.py \
  --name face-detection-retail-0004,landmarks-regression-retail-0009,face-reidentification-retail-0095 \
  --output_dir /content/model/ \
  --precisions FP32

Face_recognition_demo Use the trained model you want to use in Attached Downloader I will drop it with.

mkdir -p /Downloads/face_gallery/
cd ${INTEL_CVSDK_DIR}/inference_engine/demos/python_demos/face_recognition_demo/
python3 ./face_recognition_demo.py \
  -m_fd /content/model/intel/face-detection-retail-0004/FP32/face-detection-retail-0004.xml \
  -m_lm /content/model/intel/landmarks-regression-retail-0009/FP32/landmarks-regression-retail-0009.xml \
  -m_reid /content/model/intel/face-reidentification-retail-0095/FP32/face-reidentification-retail-0095.xml \
  --input /Downloads/input.mp4 \
  --output /Downloads/output.mp4 \
  -fg /Downloads/face_gallery/ \
  --allow_grow

Since it is Python, no build is required. Also, there is a description of pip3 install -r requirements.txt in the manual, but it was unnecessary because the dependent modules are already included. After starting, --allow_grow is added, so if you have an unknown face, you will be asked as appropriate. At that time, the face image is saved in face_gallery.

Recommended Posts

Just use OpenVINO's named face recognition demo in Docker
Just use OpenVINO's face detection demo in (Google Colab | Docker)
Use voice recognition function in Unity
[Docker] Use environment variables in Nginx conf
How to use named volume in docker-compose.yml
Use docker in proxy environment on ubuntu 20.04.1
How to use Docker in VSCode DevContainer
Understand in 5 minutes !! How to use Docker
Just install Laravel8 on docker in PHP8 environment