- Скачайте OpenVINO с официального сайта: https://software.seek.intel.com/openvino-toolkit
- Установите OpenVINO
- Откройте терминал (Development Command Prompt на Windows)
- Выставите окружение
-
Windows
"C:\Program Files (x86)\IntelSWTools\openvino\bin\setupvars.bat"
Ожидаемое сообщение:
Python 3.7.6 ECHO is off. PYTHONPATH=C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\open_model_zoo\tools\accuracy_checker;C:\Program Files (x86)\IntelSWTools\openvino\python\python3.7;C:\Program Files (x86)\IntelSWTools\openvino\python\python3;C:\Users\dkurtaev\opencv\build\lib\Release [setupvars.bat] OpenVINO environment initialized
-
Linux
source /opt/intel/openvino/bin/setupvars.sh
Ожидаемое сообщение:
[setupvars.sh] OpenVINO environment initialized
-
Скачайте модель нейронной сети для теста (2 файла):
-
Скачайте тестовое изображение: https://github.com/opencv/opencv_extra/raw/master/testdata/gpu/lbpcascade/er.png
-
Создайте файл
test_openvino.py
со следующим содержимым:import cv2 as cv # Load the model. net = cv.dnn_DetectionModel('face-detection-adas-0001.xml', 'face-detection-adas-0001.bin') # Read an image. frame = cv.imread('er.png') if frame is None: raise Exception('Image not found!') # Perform an inference. _, confidences, boxes = net.detect(frame, confThreshold=0.5) # Draw detected faces on the frame. for confidence, box in zip(list(confidences), boxes): cv.rectangle(frame, box, color=(0, 255, 0)) # Save the frame to an image file. cv.imshow('OpenVINO test', frame) cv.waitKey()
-
Запустите скрипт. Ожидается, что на экран выведется следующее изображение с найденными лицами: