私的AI研究会 > OpenModelZoo

Open Model Zoo Demos を動かす

 OpenVINO™ Toolkit に付属するデモソフトを動かしてアプリケーションで推論エンジンを使用する方法を調べる。

※ 最終更新:2021/04/15 

3D Human Pose Estimation Python* Demo

 このデモでは、OpenVINO™を使用して 3D ヒューマン ポーズ推定モデルを実行する。(機械翻訳)

使用する事前トレーニング済みモデル

デモの動作

デモの実行

(前提条件)このデモ アプリケーションを実行するには、ネイティブ Python 拡張モジュールをビルドする必要がある。

▲ 「2021.3」
  • 実行時のディレクトリ: /opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/human_pose_estimation_3d_demo/python/
  • 実行ファイル    : python3 human_pose_estimation_3d_demo.py
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ python3 action_recognition_demo.py -h
    usage: action_recognition_demo.py [-h] -i INPUT [--loop] [-o OUTPUT]
                                      [-limit OUTPUT_LIMIT] -at
                                      {en-de,en-mean,i3d-rgb} -m_en M_ENCODER
                                      [-m_de M_DECODER | --seq DECODER_SEQ_SIZE]
                                      [-l CPU_EXTENSION] [-d DEVICE] [-lb LABELS]
                                      [--no_show] [-s LABEL_SMOOTHING]
                                      [-u UTILIZATION_MONITORS]
    
    Options:
      -h, --help            Show this help message and exit.
      -i INPUT, --input INPUT
                            Required. An input to process. The input must be a
                            single image, a folder of images, video file or camera
                            id.
      --loop                Optional. Enable reading the input in a loop.
      -o OUTPUT, --output OUTPUT
                            Optional. Name of output to save.
      -limit OUTPUT_LIMIT, --output_limit OUTPUT_LIMIT
                            Optional. Number of frames to store in output. If 0 is
                            set, all frames are stored.
      -at {en-de,en-mean,i3d-rgb}, --architecture_type {en-de,en-mean,i3d-rgb}
                            Required. Specify architecture type.
      -m_en M_ENCODER, --m_encoder M_ENCODER
                            Required. Path to encoder model.
      -m_de M_DECODER, --m_decoder M_DECODER
                            Optional. Path to decoder model. Only for -at en-de.
      --seq DECODER_SEQ_SIZE
                            Optional. Length of sequence that decoder takes as
                            input.
      -l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
                            Optional. For CPU custom layers, if any. Absolute path
                            to a shared library with the kernels implementation.
      -d DEVICE, --device DEVICE
                            Optional. Specify a target device to infer on. CPU,
                            GPU, FPGA, HDDL or MYRIAD is acceptable. The demo will
                            look for a suitable plugin for the device specified.
                            Default value is CPU.
      -lb LABELS, --labels LABELS
                            Optional. Path to file with label names.
      --no_show             Optional. Don't show output.
      -s LABEL_SMOOTHING, --smooth LABEL_SMOOTHING
                            Optional. Number of frames used for output label
                            smoothing.
      -u UTILIZATION_MONITORS, --utilization-monitors UTILIZATION_MONITORS
                            Optional. List of monitors to show initially.
  • 実行例「Ubuntu Core™ i5-10210U」
    $ python3 human_pose_estimation_3d_demo.py -m ~/model/public/FP32/human-pose-estimation-3d-0001.xml -i ~/Videos/driver.mp4
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
fps13.56.61.13.91.5

Action Recognition Python* Demo

 入力ビデオで実行されているアクションを分類するアクション認識アルゴリズムのデモアプリケーション。

使用する事前トレーニング済みモデル

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ:/opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/action_recognition_demo/python/
  • 実行ファイル    : python3 action_recognition.py
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ python3 action_recognition_demo.py -h
    usage: action_recognition_demo.py [-h] -i INPUT [--loop] [-o OUTPUT]
                                      [-limit OUTPUT_LIMIT] -at
                                      {en-de,en-mean,i3d-rgb} -m_en M_ENCODER
                                      [-m_de M_DECODER | --seq DECODER_SEQ_SIZE]
                                      [-l CPU_EXTENSION] [-d DEVICE] [-lb LABELS]
                                      [--no_show] [-s LABEL_SMOOTHING]
                                      [-u UTILIZATION_MONITORS]
    
    Options:
      -h, --help            Show this help message and exit.
      -i INPUT, --input INPUT
                            Required. An input to process. The input must be a
                            single image, a folder of images, video file or camera
                            id.
      --loop                Optional. Enable reading the input in a loop.
      -o OUTPUT, --output OUTPUT
                            Optional. Name of output to save.
      -limit OUTPUT_LIMIT, --output_limit OUTPUT_LIMIT
                            Optional. Number of frames to store in output. If 0 is
                            set, all frames are stored.
      -at {en-de,en-mean,i3d-rgb}, --architecture_type {en-de,en-mean,i3d-rgb}
                            Required. Specify architecture type.
      -m_en M_ENCODER, --m_encoder M_ENCODER
                            Required. Path to encoder model.
      -m_de M_DECODER, --m_decoder M_DECODER
                            Optional. Path to decoder model. Only for -at en-de.
      --seq DECODER_SEQ_SIZE
                            Optional. Length of sequence that decoder takes as
                            input.
      -l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
                            Optional. For CPU custom layers, if any. Absolute path
                            to a shared library with the kernels implementation.
      -d DEVICE, --device DEVICE
                            Optional. Specify a target device to infer on. CPU,
                            GPU, FPGA, HDDL or MYRIAD is acceptable. The demo will
                            look for a suitable plugin for the device specified.
                            Default value is CPU.
      -lb LABELS, --labels LABELS
                            Optional. Path to file with label names.
      --no_show             Optional. Don't show output.
      -s LABEL_SMOOTHING, --smooth LABEL_SMOOTHING
                            Optional. Number of frames used for output label
                            smoothing.
      -u UTILIZATION_MONITORS, --utilization-monitors UTILIZATION_MONITORS
                            Optional. List of monitors to show initially.
  • 実行例「Ubuntu Core™ i5-10210U」
    $ python3 action_recognition_demo.py -m_en ~/model/intel/FP32/driver-action-recognition-adas-0002-encoder.xml -at en-de -m_de ~/model/intel/FP32/driver-action-recognition-adas-0002-decoder.xml -i ~/Videos/driver.mp4 -lb driver_actions.txt
    Reading IR...
    Loading IR to the plugin...
    Reading IR...
    Loading IR to the plugin...
    To close the application, press 'CTRL+C' here or switch to the output window and press Esc or Q
    Frame 15: Safe driving - 85.45% -- 3.22ms
    Frame 16: Safe driving - 87.28% -- 6.82ms
        :
        ;
    Frame 145: Safe driving - 97.24% -- 27.94ms
    Frame 146: Safe driving - 97.14% -- 27.96ms
    Frame 147: Safe driving - 97.01% -- 27.97ms
    finishing <action_recognition_demo.steps.RenderStep object at 0x7f3572d21910>
    Data total: 1.24ms (+/-: 0.98) 805.59fps
    Data   own: 1.23ms (+/-: 0.98) 811.61fps
    Encoder total: 4.14ms (+/-: 1.07) 241.51fps
    Encoder   own: 4.13ms (+/-: 1.07) 242.21fps
    Decoder total: 22.66ms (+/-: 6.40) 44.13fps
    Decoder   own: 22.65ms (+/-: 6.40) 44.15fps
    Render total: 43.39ms (+/-: 21.46) 23.04fps
    Render   own: 43.25ms (+/-: 21.02) 23.12fps
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
Data totaifps11521469984642
ms0.871010121.56
Encoder totalfps235951117521.4
ms4.310.5915.746.8
Decoder totalfps44202.5537.9
ms235040019126
Render totalfps27152.026.64.66
ms376749438215

Object Detection Python* Demo

 このデモでは、同期 API と非同期 API を使用したオブジェクト検出について説明する。
非同期 API の使用は、推論が完了するのを待つのではなく、アプリがホスト上で処理を続行できるため、アクセラレータがビジー状態の間は、アプリケーションの全体的なフレーム レートを向上させることができる。具体的には、このデモでは、フラグを使用して設定した Infer Requests の数を保持する。一部の Infer Requests は IE によって処理される、他の要求は新しいフレーム データで満たされ、非同期的に開始されるか、次の出力をインフェース要求から取得して表示できる。

 この手法は、例えば、結果として得られた(以前の)フレームを推論したり、顔検出結果の上にいくつかの感情検出のように、さらに推論を実行したりするなど、利用可能な任意の並列スラックに一般化することができる。パフォーマンスに関する重要な注意点はありますが、たとえば、並列で実行されるタスクは、共有コンピューティング リソースのオーバーサブスクライブを避けるようにすること。たとえば、推論がFPGA上で実行され、CPUが本質的にアイドル状態である場合、CPU上で並列に行う方が理にかなっている。しかし、推論がGPU上で行われる場合、デバイスがすでにビジーであるため、同じGPUで(結果のビデオ)エンコーディングを並列に行うのにはほとんど効果がない。(機械翻訳)

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: /opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/object_detection_demo/python/
  • 実行ファイル    : python3 object_detection_demo.py
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    mizutu@ubuntu-nuc10:/opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/object_detection_demo/python$ python3 object_detection_demo.py -h
    usage: object_detection_demo.py [-h] -m MODEL -at
                                    {ssd,yolo,yolov4,faceboxes,centernet,ctpn,retinaface}
                                    -i INPUT [-d DEVICE] [--labels LABELS]
                                    [-t PROB_THRESHOLD] [--keep_aspect_ratio]
                                    [--input_size INPUT_SIZE INPUT_SIZE]
                                    [-nireq NUM_INFER_REQUESTS]
                                    [-nstreams NUM_STREAMS]
                                    [-nthreads NUM_THREADS] [--loop] [-o OUTPUT]
                                    [-limit OUTPUT_LIMIT] [--no_show]
                                    [-u UTILIZATION_MONITORS] [-r]
    
    Options:
      -h, --help            Show this help message and exit.
      -m MODEL, --model MODEL
                            Required. Path to an .xml file with a trained model.
      -at {ssd,yolo,yolov4,faceboxes,centernet,ctpn,retinaface}, --architecture_type {ssd,yolo,yolov4,faceboxes,centernet,ctpn,retinaface}
                            Required. Specify model' architecture type.
      -i INPUT, --input INPUT
                            Required. An input to process. The input must be a
                            single image, a folder of images, video file or camera
                            id.
      -d DEVICE, --device DEVICE
                            Optional. Specify the target device to infer on; CPU,
                            GPU, FPGA, HDDL or MYRIAD is acceptable. The sample
                            will look for a suitable plugin for device specified.
                            Default value is CPU.
    
    Common model options:
      --labels LABELS       Optional. Labels mapping file.
      -t PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
                            Optional. Probability threshold for detections
                            filtering.
      --keep_aspect_ratio   Optional. Keeps aspect ratio on resize.
      --input_size INPUT_SIZE INPUT_SIZE
                            Optional. The first image size used for CTPN model
                            reshaping. Default: 600 600. Note that submitted
                            images should have the same resolution, otherwise
                            predictions might be incorrect.
    
    Inference options:
      -nireq NUM_INFER_REQUESTS, --num_infer_requests NUM_INFER_REQUESTS
                            Optional. Number of infer requests
      -nstreams NUM_STREAMS, --num_streams NUM_STREAMS
                            Optional. Number of streams to use for inference on
                            the CPU or/and GPU in throughput mode (for HETERO and
                            MULTI device cases use format
                            <device1>:<nstreams1>,<device2>:<nstreams2> or just
                            <nstreams>).
      -nthreads NUM_THREADS, --num_threads NUM_THREADS
                            Optional. Number of threads to use for inference on
                            CPU (including HETERO cases).
    
    Input/output options:
      --loop                Optional. Enable reading the input in a loop.
      -o OUTPUT, --output OUTPUT
                            Optional. Name of output to save.
      -limit OUTPUT_LIMIT, --output_limit OUTPUT_LIMIT
                            Optional. Number of frames to store in output. If 0 is
                            set, all frames are stored.
      --no_show             Optional. Don't show output.
      -u UTILIZATION_MONITORS, --utilization_monitors UTILIZATION_MONITORS
                            Optional. List of monitors to show initially.
    
    Debug options:
      -r, --raw_output_message
                            Optional. Output inference results raw values showing.
  • デモを実行するには、あらかじめOpenVINO™モデル ダウンローダーを使用してダウンロードした、公開モデルまたは事前トレーニング済みのモデルを使用する。
  • Infer Requests の数はフラグで指定する。この数値の増加は、デバイスが並列化をサポートしている場合、複数の Infer 要求を同時に処理できるため、通常、パフォーマンス (スループット) の増加につながる。ただし、インフェース要求の数が多いと、各フレームが推論のために送信されるまで待機する必要があるため、待機時間が長くなる。
  • FPS を高く設定する場合は、使用するすべてのデバイスで合計した値をわずかに超える値に設定することを勧める。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ python3 object_detection_demo.py -i ~/Videos/car_person.mp4 -m ~/model/intel/FP32/person-vehicle-bike-detection-crossroad-yolov3-1020.xml -at yolo
    [ INFO ] Initializing Inference Engine...
    [ INFO ] Loading network...
    [ INFO ] Reading network from IR...
    [ INFO ] Loading network to CPU plugin...
    [ INFO ] Starting inference...
    To close the application, press 'CTRL+C' here or switch to the output window and press ESC key
    Latency: 213.8 ms
    FPS: 4.6
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
Latency(ms)219.2431657515152623
fps4.52.50.21.90.4

Human Pose Estimation Python* Demo

 このデモでは、マルチパーソン 2D ポーズ推定アルゴリズムの作業を紹介する。タスクは、入力画像/ビデオ内のすべての人に対して、事前定義されたキーポイントのセットとそれらの間の接続で構成されるポーズ:ボディスケルトンを予測する。
 デモ アプリケーションは、同期モードと非同期モードの両方で推論をサポートする。

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: /opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/human_pose_estimation_demo/python/
  • 実行ファイル    : python3 human_pose_estimation_demo.py
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ python3 human_pose_estimation_demo.py -h
    usage: human_pose_estimation_demo.py [-h] -m MODEL -at {ae,openpose} -i INPUT
                                         [--loop] [-o OUTPUT]
                                         [-limit OUTPUT_LIMIT] [-d DEVICE]
                                         [-t PROB_THRESHOLD] [--tsize TSIZE]
                                         [-nireq NUM_INFER_REQUESTS]
                                         [-nstreams NUM_STREAMS]
                                         [-nthreads NUM_THREADS] [-no_show]
                                         [-u UTILIZATION_MONITORS] [-r]
    
    Options:
      -h, --help            Show this help message and exit.
      -m MODEL, --model MODEL
                            Required. Path to an .xml file with a trained model.
      -at {ae,openpose}, --architecture_type {ae,openpose}
                            Required. Specify model' architecture type.
      -i INPUT, --input INPUT
                            Required. An input to process. The input must be a
                            single image, a folder of images, video file or camera
                            id.
      --loop                Optional. Enable reading the input in a loop.
      -o OUTPUT, --output OUTPUT
                            Optional. Name of output to save.
      -limit OUTPUT_LIMIT, --output_limit OUTPUT_LIMIT
                            Optional. Number of frames to store in output. If 0 is
                            set, all frames are stored.
      -d DEVICE, --device DEVICE
                            Optional. Specify the target device to infer on; CPU,
                            GPU, FPGA, HDDL or MYRIAD is acceptable. The sample
                            will look for a suitable plugin for device specified.
                            Default value is CPU.
    
    Common model options:
      -t PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
                            Optional. Probability threshold for poses filtering.
      --tsize TSIZE         Optional. Target input size. This demo implements
                            image pre-processing pipeline that is common to human
                            pose estimation approaches. Image is first resized to
                            some target size and then the network is reshaped to
                            fit the input image shape. By default target image
                            size is determined based on the input shape from IR.
                            Alternatively it can be manually set via this
                            parameter. Note that for OpenPose-like nets image is
                            resized to a predefined height, which is the target
                            size in this case. For Associative Embedding-like nets
                            target size is the length of a short first image side.
    
    Inference options:
      -nireq NUM_INFER_REQUESTS, --num_infer_requests NUM_INFER_REQUESTS
                            Optional. Number of infer requests
      -nstreams NUM_STREAMS, --num_streams NUM_STREAMS
                            Optional. Number of streams to use for inference on
                            the CPU or/and GPU in throughput mode (for HETERO and
                            MULTI device cases use format
                            <device1>:<nstreams1>,<device2>:<nstreams2> or just
                            <nstreams>).
      -nthreads NUM_THREADS, --num_threads NUM_THREADS
                            Optional. Number of threads to use for inference on
                            CPU (including HETERO cases).
    
    Input/output options:
      -no_show, --no_show   Optional. Don't show output.
      -u UTILIZATION_MONITORS, --utilization_monitors UTILIZATION_MONITORS
                            Optional. List of monitors to show initially.
    
    Debug options:
      -r, --raw_output_message
                            Optional. Output inference results raw values showing.
    デモを実行するには、あらかじめOpenVINO™モデル ダウンローダーを使用してダウンロードした、公開モデルまたは事前トレーニング済みのモデルを使用する。
  • デデモ出力 デモでは OpenCV を使用して、推定ポーズで結果のフレームを表示する。
    デモレポート
    • FPS: ビデオフレーム処理の平均レート (1 秒あたりのフレーム数)
    • 待機時間: 1 つのフレームを処理するのに必要な平均時間 (フレームの読み取りから結果の表示まで) これらのメトリックを使用して、アプリケーション レベルのパフォーマンスを測定できる。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ python3 human_pose_estimation_demo.py -i ~/Videos/driver.mp4 -m ~/model/intel/FP32/human-pose-estimation-0001.xml -at openpose
    [ INFO ] Initializing Inference Engine...
    [ INFO ] Loading network...
    [ INFO ] Reading network from IR...
    [ INFO ] Reshape net to {'data': [1, 3, 256, 456]}
    [ INFO ] Loading network to CPU plugin...
    [ INFO ] Starting inference...
    To close the application, press 'CTRL+C' here or switch to the output window and press ESC key
    Latency: 43.5 ms
    FPS: 21.7
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
USER_SPECIFIDE modeFPS17.39.21.20.51.9
Latency (ms)44.1104714236534
MIN_LATENCY modeFPS19.99.51.23.91.7
Latency (ms)48.1101701236.5563

Gesture Recognition Python* Demo

 このデモでは、OpenVINO のツールキットを使用してジェスチャ (例: アメリカ手話 (ASL) ジェスチャ) 認識モデルを実行する方法を示す。(機械翻訳)

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: /opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/gesture_recognition_demo/python/
  • 実行ファイル    : python3 gesture_recognition_demo.py
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ python3 gesture_recognition_demo.py -h
    usage: gesture_recognition_demo.py [-h] -m_a ACTION_MODEL -m_d DETECTION_MODEL
                                       -i INPUT [-o OUTPUT] [-limit OUTPUT_LIMIT]
                                       -c CLASS_MAP [-s SAMPLES_DIR]
                                       [-t ACTION_THRESHOLD] [-d DEVICE]
                                       [-l CPU_EXTENSION] [--no_show]
                                       [-u UTILIZATION_MONITORS]
    
    Options:
      -h, --help            Show this help message and exit.
      -m_a ACTION_MODEL, --action_model ACTION_MODEL
                            Required. Path to an .xml file with a trained gesture
                            recognition model.
      -m_d DETECTION_MODEL, --detection_model DETECTION_MODEL
                            Required. Path to an .xml file with a trained person
                            detector model.
      -i INPUT, --input INPUT
                            Required. Path to a video file or a device node of a
                            web-camera.
      -o OUTPUT, --output OUTPUT
                            Optional. Name of output to save.
      -limit OUTPUT_LIMIT, --output_limit OUTPUT_LIMIT
                            Optional. Number of frames to store in output. If 0 is
                            set, all frames are stored.
      -c CLASS_MAP, --class_map CLASS_MAP
                            Required. Path to a file with gesture classes.
      -s SAMPLES_DIR, --samples_dir SAMPLES_DIR
                            Optional. Path to a directory with video samples of
                            gestures.
      -t ACTION_THRESHOLD, --action_threshold ACTION_THRESHOLD
                            Optional. Threshold for the predicted score of an
                            action.
      -d DEVICE, --device DEVICE
                            Optional. Specify the target device to infer on: CPU,
                            GPU, FPGA, HDDL or MYRIAD. The demo will look for a
                            suitable plugin for device specified (by default, it
                            is CPU).
      -l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
                            Optional. Required for CPU custom layers. Absolute
                            path to a shared library with the kernels
                            implementations.
      --no_show             Optional. Do not visualize inference results.
      -u UTILIZATION_MONITORS, --utilization_monitors UTILIZATION_MONITORS
                            Optional. List of monitors to show initially.
     デモは人の追跡モードで開始し、アクション認識モードで切り替えるには、適切な検出ID(各境界ボックスの左上の数字)を持つボタンを押す必要がある。フレームに含まれる人が 1 人だけの場合、それらは自動的に選択される。その後、スペースボタンを押してトラッキングモードに戻ることができる。  デモを実行するには、IR 形式のジェスチャ認識モデルと人物検出モデル、クラス名のファイル、および入力ビデオへのパスを指定する。
    python3 gesture_recognition_demo.py -m_a ~/model/intel/FP32/asl-recognition-0004.xml -m_d ~/model/intel/FP32/person-detection-asl-0001.xml -i ~/Videos/ASK_Please.mp4 -c /opt/intel/openvino_2021/deployment_tools/open_model_zoo/data/dataset_classes/msasl100.json
  • デモ出力 アプリケーションは、OpenCVを使用して、ジェスチャ認識の結果と現在の推論のパフォーマンスを表示する。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ python3 gesture_recognition_demo.py -m_a ~/model/intel/FP32/asl-recognition-0004.xml -m_d ~/model/intel/FP32/person-detection-asl-0001.xml -i ~/Videos/ASK_Please.mp4 -c /opt/intel/openvino_2021/deployment_tools/open_model_zoo/data/dataset_classes/msasl100.json
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
fps14.38.70.95X1.9
fps14.58.80.94X1.9

Handwritten Text Recognition Demo

 OpenVINO™を使用して手書きの日本語および簡体字中国語のテキスト行を認識する方法を示す。日本語の場合、このデモでは、Kondateと Nakayosiのデータセットのすべての文字がサポートされている。簡体字中国語の場合は、SCUT-EPT dataset の文字をサポートしている。(機械翻訳)

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: /opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/handwritten_text_recognition_demo/python/
  • 実行ファイル    : python3 handwritten_text_recognition_demo.py
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ python3 handwritten_text_recognition_demo.py -h
    usage: handwritten_text_recognition_demo.py [-h] -m MODEL -i INPUT [-d DEVICE]
                                                [-ni NUMBER_ITER] [-cl CHARLIST]
                                                [-dc DESIGNATED_CHARACTERS]
                                                [-tk TOP_K]
    
    Options:
      -h, --help            Show this help message and exit.
      -m MODEL, --model MODEL
                            Path to an .xml file with a trained model.
      -i INPUT, --input INPUT
                            Required. Path to an image to infer
      -d DEVICE, --device DEVICE
                            Optional. Specify the target device to infer on; CPU,
                            GPU, FPGA, HDDL, MYRIAD or HETERO: is acceptable. The
                            sample will look for a suitable plugin for device
                            specified. Default value is CPU
      -ni NUMBER_ITER, --number_iter NUMBER_ITER
                            Optional. Number of inference iterations
      -cl CHARLIST, --charlist CHARLIST
                            Path to the decoding char list file. Default is for
                            Japanese
      -dc DESIGNATED_CHARACTERS, --designated_characters DESIGNATED_CHARACTERS
                            Optional. Path to the designated character file
      -tk TOP_K, --top_k TOP_K
                            Optional. Top k steps in looking up the decoded
                            character, until a designated one is found
     デモを実行するには、あらかじめOpenVINO™モデル ダウンローダーを使用してダウンロードした、公開モデルまたは事前トレーニング済みのモデルを使用する。

     引数が指定されている場合、出力文字が指定された文字に含まれていない場合、スクリプトは、指定された文字が見つかるまで、デコードされた文字を検索する上の k のステップをチェックする。これにより、出力文字は指定された領域に制限される。既定では、K は 20 に設定されている。
    たとえば、出力文字を数字とハイフンのみに制限する場合は、指定された文字ファイルへのパスを指定する必要がある。その後、スクリプトは出力文字に対して後のフィルタリング処理を実行する、K が選択した最初の要素に何も含めなければ、他の文字が許可される可能性があることに注意すること。
  • デデモ出力 アプリケーションは、結果の認識テキストと推論のパフォーマンスを表示するために、ターミナルを使用する。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ python3 handwritten_text_recognition_demo.py -i data/handwritten_japanese_test.png -m ~/model/intel/FP32/handwritten-japanese-recognition-0001.xml
    [ INFO ] Loading network
    [ INFO ] Preparing input/output blobs
    [ INFO ] Loading model to the plugin
    [ INFO ] Starting inference (1 iterations)
    ['菊池朋子']
    [ INFO ] Average throughput: 275.6483554840088 ms
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
Average throughput(ms)27760343538662742

Text Detection C++ Demo

ニューラルネットワークを使用して、さまざまな環境で任意の角度で回転した印刷テキストを検出して認識する例。

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ:~/omz_demos_build/intel64/Release
  • 実行ファイル    :./text_detection_demo
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ ./text_detection_demo -h
    InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    text_detection_demo [OPTION]
    Options:
    
        -h                           Print a usage message.
        -i                           Required. An input to process. The input must be a single image, a folder of images, video file or camera id.
        -loop                        Optional. Enable reading the input in a loop.
        -o "<path>"                Optional. Name of output to save.
        -limit "<num>"             Optional. Number of frames to store in output. If 0 is set, all frames are stored.
        -m_td "<path>"               Required. Path to the Text Detection model (.xml) file.
        -m_tr "<path>"               Required. Path to the Text Recognition model (.xml) file.
        -m_tr_ss "<value>"           Optional. Symbol set for the Text Recognition model.
        -tr_pt_first                   Optional. Specifies if pad token is the first symbol in the alphabet. Default is false
        -tr_o_blb_nm                   Optional. Name of the output blob of the model which would be used as model output. If not stated, first blob of the model would be used.
        -cc                          Optional. If it is set, then in case of absence of the Text Detector, the Text Recognition model takes a central image crop as an input, but not full frame.
        -w_td "<value>"              Optional. Input image width for Text Detection model.
        -h_td "<value>"              Optional. Input image height for Text Detection model.
        -thr "<value>"               Optional. Specify a recognition confidence threshold. Text detection candidates with text recognition confidence below specified threshold are rejected.
        -cls_pixel_thr "<value>"     Optional. Specify a confidence threshold for pixel classification. Pixels with classification confidence below specified threshold are rejected.
        -link_pixel_thr "<value>"    Optional. Specify a confidence threshold for pixel linkage. Pixels with linkage confidence below specified threshold are not linked.
        -max_rect_num "<value>"      Optional. Maximum number of rectangles to recognize. If it is negative, number of rectangles to recognize is not limited.
        -d_td "<device>"             Optional. Specify the target device for the Text Detection model to infer on (the list of available devices is shown below). The demo will look for a suitable plugin for a specified device. By default, it is CPU.
        -d_tr "<device>"             Optional. Specify the target device for the Text Recognition model to infer on (the list of available devices is shown below). The demo will look for a suitable plugin for a specified device. By default, it is CPU.
        -l "<absolute_path>"         Optional. Absolute path to a shared library with the CPU kernels implementation for custom layers.
        -c "<absolute_path>"         Optional. Absolute path to the GPU kernels implementation for custom layers.
        -no_show                     Optional. If it is true, then detected text will not be shown on image frame. By default, it is false.
        -r                           Optional. Output Inference results as raw values.
        -u                           Optional. List of monitors to show initially.
        -b                           Optional. Bandwidth for CTC beam search decoder. Default value is 0, in this case CTC greedy decoder will be used.
    [E:] [BSL] found 0 ioexpander device
    
    Available target devices:  CPU  GNA  MYRIAD
  • デモを実行するには、あらかじめOpenVINO™モデル ダウンローダーを使用してダウンロードした、公開モデルまたは事前トレーニング済みのモデルを使用する。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ ./text_detection_demo -loop -m_td ~/model/intel/FP32/text-detection-0004.xml -m_tr ~/model/intel/FP32/text-recognition-0012.xml -i ~/Images/text-img.jpg
    InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    [ INFO ] Parsing input parameters
    [ INFO ] Loading Inference Engine
    [ INFO ] Device info: 
    [ INFO ] 	CPU
    	MKLDNNPlugin version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    [ INFO ] Loading network files
    [ INFO ] Starting inference
    To close the application, press 'CTRL+C' here or switch to the output window and press ESC or Q
    text detection model inference (ms) (fps): 122.258 8.17942
    text detection postprocessing (ms) (fps): 59.7419 16.7387
    
    text recognition model inference (ms) (fps): 7.09908 140.863
    text recognition postprocessing (ms) (fps): 0.00714286 140000
    
    text crop (ms) (fps): 0.0477028 20963.1
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
detection model inferencems10218511546851079
fps9.85.40.871.460.93
detection model postprocessingms40.469148154111
fps24.714.46.766.509.0
recognition model inferencems7.114.610376.077.3
fps14068.79.7013.212.9
recognition model postprocessingms0.0070.010.0150.040.012
fps13636491731633482316081328

Crossroad Camera C++ Demo

このデモでは、人の検出、認識、再識別のための推論パイプラインを提供する。デモでは、人物検出ネットワークを使用し、その後に検出結果の上に適用される個人属性認識および個人再識別ネットワークを使用する。

使用する事前トレーニング済みモデル

デモの目的

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ:~/omz_demos_build/intel64/Release
  • 実行ファイル    :./crossroad_camera_demo
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ ./crossroad_camera_demo -h
    InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    crossroad_camera_demo [OPTION]
    Options:
    
        -h                           Print a usage message.
        -i                           Required. An input to process. The input must be a single image, a folder of images, video file or camera id.
        -loop                        Optional. Enable reading the input in a loop.
        -o "<path>"                Optional. Name of output to save.
        -limit "<num>"             Optional. Number of frames to store in output. If 0 is set, all frames are stored.
        -m "<path>"                  Required. Path to the Person/Vehicle/Bike Detection Crossroad model (.xml) file.
        -m_pa "<path>"               Optional. Path to the Person Attributes Recognition Crossroad model (.xml) file.
        -m_reid "<path>"             Optional. Path to the Person Reidentification Retail model (.xml) file.
          -l "<absolute_path>"       Optional. For MKLDNN (CPU)-targeted custom layers, if any. Absolute path to a shared library with the kernels impl.
              Or
          -c "<absolute_path>"       Optional. For clDNN (GPU)-targeted custom kernels, if any. Absolute path to the xml file with the kernels desc.
        -d "<device>"                Optional. Specify the target device for Person/Vehicle/Bike Detection. The list of available devices is shown below. Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The application looks for a suitable plugin for the specified device.
        -d_pa "<device>"             Optional. Specify the target device for Person Attributes Recognition. The list of available devices is shown below. Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The application looks for a suitable plugin for the specified device.
        -d_reid "<device>"           Optional. Specify the target device for Person Reidentification Retail. The list of available devices is shown below. Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The application looks for a suitable plugin for the specified device.
        -pc                          Optional. Enables per-layer performance statistics.
        -r                           Optional. Output Inference results as raw values.
        -t                           Optional. Probability threshold for person/vehicle/bike crossroad detections.
        -t_reid                      Optional. Cosine similarity threshold between two vectors for person reidentification.
        -no_show                     Optional. No show processed video.
        -auto_resize                 Optional. Enables resizable input with support of ROI crop & auto resize.
        -u                           Optional. List of monitors to show initially.
        -person_label                Optional. The integer index of the objects' category corresponding to persons (as it is returned from the detection network, may vary from one network to another). The default value is 1.
    [E:] [BSL] found 0 ioexpander device
    
    Available target devices:  CPU  GNA  MYRIAD
  • デモを実行するには、あらかじめOpenVINO™モデル ダウンローダーを使用してダウンロードした、公開モデルまたは事前トレーニング済みのモデルを使用する。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ ./crossroad_camera_demo -i ~/Videos/car.mp4 -m ~/model/intel/FP32/person-vehicle-bike-detection-crossroad-0078.xml
    InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    [ INFO ] Parsing input parameters
    [ INFO ] Person Attributes Recognition detection DISABLED
    [ INFO ] Person Reidentification Retail detection DISABLED
    [ INFO ] Loading device CPU
    [ INFO ] 	CPU
    	MKLDNNPlugin version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    [ INFO ] Loading network files for PersonDetection
    [ INFO ] Batch size is forced to  1
    [ INFO ] Checking Person Detection inputs
    [ INFO ] Checking Person Detection outputs
    [ INFO ] Loading Person Detection model to the CPU device
    [ INFO ] Start inference 
    To close the application, press 'CTRL+C' here or switch to the output window and press ESC key
    [ INFO ] Total Inference time: 8901.55
    
    [ INFO ] Execution successful
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
detection time(ms)3050.1312.2275.3342
fps32143,13.63.0

Human Pose Estimation C++ Demo

 マルチパーソン 2D ポーズ推定アルゴリズムを紹介する。タスクは、入力ビデオのすべての人に対して、キーポイントとそれらの間の接続で構成されるポーズ・ボディスケルトンを予測する。ポーズには、最大 18 のキーポイントが含まれている可能性がある。耳、目、鼻、首、肩、肘、手首、腰、膝、および足首。アルゴリズムの潜在的なユースケースのいくつかは、アクション認識と行動理解である。(機械翻訳)

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: ~/omz_demos_build/intel64/Release/
  • 実行ファイル    : ./human_pose_estimation_demo
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ ./human_pose_estimation_demo -h
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    human_pose_estimation [OPTION]
    Options:
    
        -h                        Print a usage message.
        -at "<type>"              Required. Type of the network, either 'ae' for Associative Embedding or 'openpose' for OpenPose.
        -i                          Required. An input to process. The input must be a single image, a folder of images, video file or camera id.
        -m "<path>"               Required. Path to an .xml file with a trained model.
        -o "<path>"                Optional. Name of output to save.
        -limit "<num>"             Optional. Number of frames to store in output. If 0 is set, all frames are stored.
        -tsize                      Optional. Target input size.
          -l "<absolute_path>"    Required for CPU custom layers. Absolute path to a shared library with the kernel implementations.
              Or
          -c "<absolute_path>"    Required for GPU custom kernels. Absolute path to the .xml file with the kernel descriptions.
        -d "<device>"             Optional. Specify the target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
        -pc                       Optional. Enables per-layer performance report.
        -t                        Optional. Probability threshold for poses filtering.
        -nireq "<integer>"        Optional. Number of infer requests. If this option is omitted, number of infer requests is determined automatically.
        -nthreads "<integer>"     Optional. Number of threads.
        -nstreams                 Optional. Number of streams to use for inference on the CPU or/and GPU in throughput mode (for HETERO and MULTI device cases use format <device1>:<nstreams1>,<device2>:<nstreams2> or just <nstreams>)
        -loop                     Optional. Enable reading the input in a loop.
        -no_show                  Optional. Do not show processed video.
        -u                        Optional. List of monitors to show initially.
    [E:] [BSL] found 0 ioexpander device
    
    Available target devices:  CPU  GNA  MYRIAD
    デモを実行するには、あらかじめOpenVINO™モデル ダウンローダーを使用してダウンロードした、公開モデルまたは事前トレーニング済みのモデルを使用する。
  • デデモ出力  デモでは、OpenCVを使用して、結果として得られたフレームをFPSの推定ポーズとテキストレポート(人間のポーズ推定デモの秒あたりのフレーム数)で表示する。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ ./human_pose_estimation_demo -at openpose -i ~/Videos/driver.mp4 -m ~/model/intel/FP32/human-pose-estimation-0001.xml
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    [ INFO ] Parsing input parameters
    [ INFO ] Reading input
    [ INFO ] Loading Inference Engine
    [ INFO ] Device info: 
    [ INFO ] 	CPU
    	MKLDNNPlugin version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    Loading network files
    [ INFO ] Batch size is forced to 1.
    [ INFO ] Loading model to the device
    
    [ INFO ] Metric reports:
    Latency: 224.2 ms
    FPS: 21.9
    [ INFO ] 
    
    [ INFO ] The execution has completed successfully
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
SYNCOpwnCV cap/render timems59.6363716.5
Wallclock timems45100710248510
fps13101.44.11.93
Detection timems4595677205503
fps22101.54.01.8
ASYNCOpwnCV cap/render timems914693628
Wallclock timems509571242536
fps19101.4242.0

Object Detection C++ Demo

 このデモでは、オブジェクト検出と非同期 API について説明する。非同期 API の使用は、推論が完了するのを待つのではなく、アプリがホスト上で処理を続行できるため、アクセラレータがビジー状態の間は、アプリケーションの全体的なフレーム レートを向上させることができる。具体的には、このデモでは、フラグを使用して設定したイン推測リクエストの数を保持する。一部のインフェル要求は IE によって処理されるが、他の要求は新しいフレーム データで満たされ、非同期的に開始されるか、次の出力をインフェース要求から取得して表示できる。
 この手法は、例えば、結果として得られた(以前の)フレームを推論したり、顔検出結果の上にいくつかの感情検出のように、さらに推論を実行したりするなど、利用可能な任意の並列スラックに一般化することができる。パフォーマンスに関する重要な注意点はあるが、たとえば、並列で実行されるタスクは、共有コンピューティング リソースのオーバーサブスクライブを避けるようにすること。たとえば、推論がFPGA上で実行され、CPUが本質的にアイドル状態である場合、CPU上で並列に行う方が理にかなっている。しかし、推論がGPU上で行われる場合、デバイスがすでにビジーであるため、同じGPUで(結果のビデオ)エンコーディングを並列に行うのにはほとんど効果がない。
(機械翻訳)

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: ~/omz_demos_build/intel64/Release
  • 実行ファイル    : ./object_detection_demo
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ ./object_detection_demo -h
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    object_detection_demo [OPTION]
    Options:
    
        -h                        Print a usage message.
        -at "<type>"              Required. Architecture type: centernet, faceboxes, retinaface, ssd or yolo
        -i                          Required. An input to process. The input must be a single image, a folder of images, video file or camera id.
        -m "<path>"               Required. Path to an .xml file with a trained model.
        -o "<path>"               Optional. Name of output to save.
        -limit "<num>"            Optional. Number of frames to store in output. If 0 is set, all frames are stored.
          -l "<absolute_path>"    Required for CPU custom layers. Absolute path to a shared library with the kernel implementations.
              Or
          -c "<absolute_path>"    Required for GPU custom kernels. Absolute path to the .xml file with the kernel descriptions.
        -d "<device>"             Optional. Specify the target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device.
        -labels "<path>"          Optional. Path to a file with labels mapping.
        -pc                       Optional. Enables per-layer performance report.
        -r                        Optional. Inference results as raw values.
        -t                        Optional. Probability threshold for detections.
        -iou_t                    Optional. Filtering intersection over union threshold for overlapping boxes.
        -auto_resize              Optional. Enables resizable input with support of ROI crop & auto resize.
        -nireq "<integer>"        Optional. Number of infer requests. If this option is omitted, number of infer requests is determined automatically.
        -nthreads "<integer>"     Optional. Number of threads.
        -nstreams                 Optional. Number of streams to use for inference on the CPU or/and GPU in throughput mode (for HETERO and MULTI device cases use format <device1>:<nstreams1>,<device2>:<nstreams2> or just <nstreams>)
        -loop                     Optional. Enable reading the input in a loop.
        -no_show                  Optional. Do not show processed video.
        -u                        Optional. List of monitors to show initially.
        -yolo_af                  Optional. Use advanced postprocessing/filtering algorithm for YOLO.
    [E:] [BSL] found 0 ioexpander device
    
    Available target devices:  CPU  GNA  MYRIAD
  • デモ出力  デモでは OpenCV を使用して、結果のフレームを検出とともに表示する (境界ボックスとラベル (表示されている場合) を表示。
    デモレポート:
    • FPS: ビデオ フレーム処理の平均レート (1 秒あたりのフレーム数)。
    • レイテンシー: フレームの読み取りから結果の表示まで、1 つのフレームを処理するのに必要な平均時間。これらのメトリックは両方とも使用して、アプリケーション レベルのパフォーマンスを測定できる。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ ./object_detection_demo -i ~/Videos/video001.mp4 -at ssd -m ~/model/intel/FP32/person-detection-retail-0013.xml
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    [ INFO ] Parsing input parameters
    [ INFO ] Reading input
    [ INFO ] Loading Inference Engine
    [ INFO ] Device info: 
    [ INFO ] 	CPU
    	MKLDNNPlugin version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    Loading network files
    [ INFO ] Batch size is forced to 1.
    [ INFO ] Checking that the inputs are as the demo expects
    [ INFO ] Checking that the outputs are as the demo expects
    [ INFO ] Loading model to the device
    
    [ INFO ] Metric reports:
    Latency: 62.6 ms
    FPS: 77.3
    [ INFO ] 
    
    [ INFO ] The execution has completed successfully
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
Latency(ms)2245259.3145.1162
fps73.042.37.513.011.8

Smart Classroom C++ Demo

 このデモでは、いくつかのニューラルネットワークを共同で使用して、学生の行動(座って立ち、モデルのために手を挙げ、座り、手を挙げ、立ち上げ、振り向き、モデルの机の上に横たわる)を検出し、教室環境で顔で人々を認識する例を示している。デモでは、アクションおよび顔検出ネットワークに非同期 API を使用し顔認識と検出の実行を並列化することができる。顔認識が1つのアクセラレータで実行されている間、顔とアクション検出は別のアクセラレータで実行することができる。
(機械翻訳)

使用する事前トレーニング済みモデル

デモの動作

顔認識用のギャラリーの作成

 フレーム上の顔を認識するには、デモでは参照画像のギャラリーが必要。各画像には、顔のタイトなトリミングが含まれている必要がある。ギャラリーは、任意の画像リストから作成できる。

  1. 正面向きの顔のタイトな作物を含む画像を別の空のフォルダに配置する(またはデモのキーを使用する)。各 ID には、1 つのイメージのみを含む必要がある。イメージに 名前を付る。
    -crop_galleryid_name0.png, id_name1.png, ...
    + このコマンドを実行して、ファイルと ID の一覧をフォーマットで取得する。~
    create_list.py <path_to_folder_with_images>.json

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: ~/omz_demos_build/intel64/Release
  • 実行ファイル    : ./smart_classroom_demo
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ ./smart_classroom_demo -h
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    smart_classroom_demo [OPTION]
    Options:
    
        -h                             Print a usage message.
        -i                             Required. An input to process. The input must be a single image, a folder of images, video file or camera id.
        -loop                          Optional. Enable reading the input in a loop.
        -read_limit                    Optional. Read length limit before stopping or restarting reading the input.
        -o "<path>"                  Optional. Name of output to save.
        -limit "<num>"               Optional. Number of frames to store in output. If 0 is set, all frames are stored.
        -m_act '<path>'                Required. Path to the Person/Action Detection Retail model (.xml) file.
        -m_fd '<path>'                 Required. Path to the Face Detection model (.xml) file.
        -m_lm '<path>'                 Required. Path to the Facial Landmarks Regression Retail model (.xml) file.
        -m_reid '<path>'               Required. Path to the Face Reidentification Retail model (.xml) file.
        -l '<absolute_path>'           Optional. For CPU custom layers, if any. Absolute path to a shared library with the kernels implementation.
              Or
        -c '<absolute_path>'           Optional. For GPU custom kernels, if any. Absolute path to an .xml file with the kernels description.
        -d_act '<device>'              Optional. Specify the target device for Person/Action Detection Retail (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The application looks for a suitable plugin for the specified device.
        -d_fd '<device>'               Optional. Specify the target device for Face Detection Retail (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The application looks for a suitable plugin for the specified device.
        -d_lm '<device>'               Optional. Specify the target device for Landmarks Regression Retail (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The application looks for a suitable plugin for the specified device.
        -d_reid '<device>'             Optional. Specify the target device for Face Reidentification Retail (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The application looks for a suitable plugin for the specified device.
        -greedy_reid_matching          Optional. Use faster greedy matching algorithm in face reid.
        -pc                            Optional. Enables per-layer performance statistics.
        -r                             Optional. Output Inference results as raw values.
        -ad                            Optional. Output file name to save per-person action statistics in.
        -t_ad                          Optional. Probability threshold for person/action detection.
        -t_ar                          Optional. Probability threshold for action recognition.
        -t_fd                          Optional. Probability threshold for face detections.
        -inh_fd                        Optional. Input image height for face detector.
        -inw_fd                        Optional. Input image width for face detector.
        -exp_r_fd                      Optional. Expand ratio for bbox before face recognition.
        -t_reid                        Optional. Cosine distance threshold between two vectors for face reidentification.
        -fg                            Optional. Path to a faces gallery in .json format.
        -teacher_id                    Optional. ID of a teacher. You must also set a faces gallery parameter (-fg) to use it.
        -no_show                       Optional. Do not show processed video.
        -min_ad                        Optional. Minimum action duration in seconds.
        -d_ad                          Optional. Maximum time difference between actions in seconds.
        -student_ac                    Optional. List of student actions separated by a comma.
        -top_ac                        Optional. List of student actions (for top-k mode) separated by a comma.
        -teacher_ac                    Optional. List of teacher actions separated by a comma.
        -top_id                        Optional. Target action name.
        -a_top                         Optional. Number of first K students. If this parameter is positive, the demo detects first K persons with the action, pointed by the parameter 'top_id'
        -crop_gallery                  Optional. Crop images during faces gallery creation.
        -t_reg_fd                      Optional. Probability threshold for face detections during database registration.
        -min_size_fr                   Optional. Minimum input size for faces during database registration.
        -al                            Optional. Output file name to save per-person action detections in.
        -ss_t                          Optional. Number of frames to smooth actions.
        -u                             Optional. List of monitors to show initially.
    [E:] [BSL] found 0 ioexpander device
    
    Available target devices:  CPU  GNA  MYRIAD
  • 学生の行動を認識するための事前トレーニング済みモデルを使用してアプリケーションを実行する有効なコマンド ラインの例:
    ./smart_classroom_demo -m_act <path_to_model>/person-detection-action-recognition-0005.xml \
                           -m_fd <path_to_model>/face-detection-adas-0001.xml \
                           -i <path_to_video>
    注意: 学生の行動を認識するには、3つの基本的なアクションのモデルと6つのアクションのモデルを使用すること。
    person-detection-action-recognition-0005~
    person-detection-action-recognition-0006~
  • 最初に挙げた受講者を認識するためのアプリケーションを実行する有効なコマンド ラインの例:
    ./smart_classroom_demo -m_act <path_to_model>/person-detection-raisinghand-recognition-0001.xml \
                           -a_top <number of first raised-hand students> \
                           -i <path_to_video>
    メモ: 学生の挙手行動を認識するには、モデルを使用すること。
    person-detection-raisinghand-recognition-0001
  • デモ出力  デモでは OpenCV を使用して、結果のフレームにアクションと面のラベルが付いて表示される。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ ./smart_classroom_demo -m_act ~/model/intel/FP32/person-detection-action-recognition-0005.xml -m_fd ~/model/intel/FP32/face-detection-adas-0001.xml -i ~/Videos/classroom_s.mp4
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    [ INFO ] Parsing input parameters
    [ INFO ] Loading Inference Engine
    [ INFO ] Device info: 
    [ INFO ] 	CPU
    	MKLDNNPlugin version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    [ WARNING ] Face recognition models are disabled!
    To close the application, press 'CTRL+C' here or switch to the output window and press ESC key
    
    [ INFO ] Mean FPS: 20.5493
    [ INFO ] Frames processed: 428
    
    [ INFO ] Execution successful
▼ 「2021.2」

速度比較

項目Core™ i5-10210Core™ i7-6700Celeron® J4005Celeron® J4005 + NCS2Core™ i7-2620M
fps2112132.3

Pedestrian Tracker C++ Demo

 このデモでは、歩行者追跡シナリオを紹介し、入力ビデオシーケンスからフレームを読み取り、フレーム内の歩行者を検出し、フレームごとに歩行者の移動軌道を構築する。

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: ~/omz_demos_build/intel64/Release
  • 実行ファイル    : ./pedestrian_tracker_demo
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ ./pedestrian_tracker_demo -h
    InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    pedestrian_tracker_demo [OPTION]
    Options:
    
        -h                           Print a usage message.
        -i                           Required. An input to process. The input must be a single image, a folder of images, video file or camera id.
        -loop                        Optional. Enable reading the input in a loop.
        -first                       Optional. The index of the first frame of the input to process. The actual first frame captured depends on cv::VideoCapture implementation and may have slightly different number.
        -read_limit                  Optional. Read length limit before stopping or restarting reading the input.
        -o "<path>"                Optional. Name of output to save.
        -limit "<num>"             Optional. Number of frames to store in output. If 0 is set, all frames are stored.
        -m_det "<path>"              Required. Path to the Pedestrian Detection Retail model (.xml) file.
        -m_reid "<path>"             Required. Path to the Pedestrian Reidentification Retail model (.xml) file.
        -l "<absolute_path>"         Optional. For CPU custom layers, if any. Absolute path to a shared library with the kernels implementation.
              Or
        -c "<absolute_path>"         Optional. For GPU custom kernels, if any. Absolute path to the .xml file with the kernels description.
        -d_det "<device>"            Optional. Specify the target device for pedestrian detection (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin.
        -d_reid "<device>"           Optional. Specify the target device for pedestrian reidentification (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin.
        -r                           Optional. Output pedestrian tracking results in a raw format (compatible with MOTChallenge format).
        -pc                          Optional. Enable per-layer performance statistics.
        -no_show                     Optional. Do not show processed video.
        -delay                       Optional. Delay between frames used for visualization. If negative, the visualization is turned off (like with the option 'no_show'). If zero, the visualization is made frame-by-frame.
        -out "<path>"                Optional. The file name to write output log file with results of pedestrian tracking. The format of the log file is compatible with MOTChallenge format.
        -u                           Optional. List of monitors to show initially.
    [E:] [BSL] found 0 ioexpander device
    
    Available target devices:  CPU  GNA  MYRIAD
  • デモ出力  デモでは OpenCV を使用して、バウンディング ボックス、カーブ(表示する軌道)、テキストとしてレンダリングされた検出を含むフレームを表示する。
  • 実行例「Ubuntu Core™ i5-10210U」
    $ ./pedestrian_tracker_demo -i ~/Videos/video003_m.mp4 -m_det ~/model/intel/FP32/person-detection-retail-0013.xml -m_reid ~/model/intel/FP32/person-reidentification-retail-0288.xml
    InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    Loading device CPU
    	CPU
    	MKLDNNPlugin version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    To close the application, press 'CTRL+C' here or switch to the output window and press ESC key
    
    Execution successful
▼ 「2021.2」

Super Resolution C++ Demo

 元の低解像度のイメージから高解像度のイメージを再構築するスーパー解像度のデモ アプリケーション。

使用する事前トレーニング済みモデル

デモの動作

デモの実行

▲ 「2021.3」
  • 実行時のディレクトリ: ~/omz_demos_build/intel64/Release
  • 実行ファイル    : ./super_resolution_demo
  • 「-h」オプションを指定してアプリケーションを実行すると、次の使用法メッセージが表示される。
    $ ./super_resolution_demo -h
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    [ INFO ] Parsing input parameters
    
    super_resolution_demo [OPTION]
    Options:
    
        -h                      Print a usage message.
        -i "<path>"             Required. Path to an image.
        -m "<path>"             Required. Path to an .xml file with a trained model.
        -d "<device>"           Optional. Specify the target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for the specified device.
        -show                   Optional. Show processed images. Default value is false.
    [E:] [BSL] found 0 ioexpander device
    
    Available target devices:  CPU  GNA  MYRIAD
  • デモ出力  アプリケーションは、再構築された高解像度イメージを出力し、現在の作業ディレクトリにプレフィックス付きのファイルとして保存する。
    ~/omz_demos_build/intel64/Release/sr_1.png
  • 実行例「Ubuntu Core™ i5-10210U」
    $ ./super_resolution_demo -i ~/Images/image-low.bmp -m ~/model/intel/FP32/single-image-super-resolution-1032.xml -show true
    [ INFO ] InferenceEngine: 	API version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    [ INFO ] Parsing input parameters
    [ INFO ] Files were added: 1
    [ INFO ]     /home/mizutu/Images/image-low.bmp
    [ INFO ] Loading Inference Engine
    [ INFO ] Device info: 
    [ INFO ] 	CPU
    	MKLDNNPlugin version ......... 2.1
    	Build ........... 2021.3.0-2787-60059f2c755-releases/2021/3
    
    [ INFO ] Loading network files
    [ INFO ] Preparing input blobs
    [ INFO ] Batch size is 1
    [ INFO ] Preparing output blobs
    [ INFO ] Loading model to the device
    [ INFO ] Create infer request
    To close the application, press 'CTRL+C' here or switch to the output window and press any key
    [ INFO ] Start inference
    [ INFO ] Output size [N,C,H,W]: 1, 3, 1080, 1920
    [ INFO ] Execution successful
    
    [ INFO ] This demo is an API example, for any performance measurements please use the dedicated benchmark_app tool from the openVINO toolkit
▼ 「2021.2」

更新履歴

参考資料

デモソフトが動作するまでのエラー処理など

▼ 「2021.2」
 

Raspberry Pi4 でのデモソフトの実行

▼ 「2021.2」

テスト環境

Intel® NUC キット BXNUC10I5FNH

HP EliteDesk 800 G2 SFF

Intel® NUC キット BOXNUC7CJYH

Raspberry Pi4 ModelB 4GB

Panasonic CF-B10BWJYS

オフィシャルサイト


Last-modified: 2021-07-14 (水) 14:15:45