【ドキュメント】設定ファイル詳細 FACE01 v1.4.10

ここではv1.4.10のFACE01_SAMPLE/docs/config_ini.mdに簡単な日本語訳をつけてご紹介したいと思います。

最新バージョンのドキュメントは以下からご覧になれます。

オプション変数は呼び出す側に自由度を与えますが、反対に顔認証のアルゴリズムや各々のオプション変数の働きが分かっていないと期待しない動作になってしまいます。

config.ini を変更する前に、ConfigParser モジュールに精通している必要があります。ConfigParser モジュールを参照するには、以下を参照してください。
https://docs.python.org/3/library/configparser.html

設定値の継承

各セクションは [DEFAULT] セクションから継承します。

そのため、各セクションで [DEFAULT] をオーバーライドする項目 (キーと値) のみを指定してください。

編集

docker Image を使用している場合は、config.ini を vim で編集して変更できます。

# Example
$ vim ./config.ini

各オプション変数の働き

[DEFAULT]

[DEFAULT] セクションは簡単な例です。
この [DEFAULT] 設定は、CUI モードのみを使用します。

また、この設定は、PC に Nvidia GPU カードまたは IOT デバイスがインストールされていないユーザー向けです。

[DEFAULT] セクションは、すべてのセクションの継承元です。

headless

headless は「CUI モードで動作する」ことを意味します。 GUI ウィンドウを表示したい場合は、値を False に設定しますが、処理速度は遅くなります。

  • Type: bool
  • Default: True

anti_spoof

  • Experimental
  • Anti-spoof model is included with this sample, but please do not use this model as is for commercial use. Please contact tokai-kaoninsho for details.
  • Type: bool
  • Default: False

output_debug_log

  • When True, will output debug log.
  • Type: bool
  • Default: False

log_level

  • If you want to output debug log and message, modify this value to debug.
  • Type: str
  • Default: info

set_width

  • Specify width of GUI window.
  • Type: int
  • Default: 750

similar_percentage

  • Number of % which determine if the person on the screen is the person in the registered face information.
  • Type: float
  • Default: 99.1

jitters

  • Number of value what means calculate jitters on running FACE01.
  • Type: int
  • Default: 0

ゆらぎ値。デフォルト値0

入力画像を受け取り、色を乱し、ランダムな移動、回転、スケーリングを適用します。
jitters の値を大きくするほどランダムな変換の平均値をとるようになります。
しかしながら大きな値をとることによって入力画像が不確かなものになっていくこと、処理時間が長くなることが懸念されます。

(参照箇所:…/dlib/python_examples/face_jitter.py)

priset_face_images_jitters

  • Number of value what means calculate jitters for priset_face_images.
  • Type: int
  • Default: 100

登録顔画像のゆらぎ値。登録顔画像の計算は最初の1回しか行われません。

upsampling

  • Specifying the detected face area. ex. 0: 80x80px, 1: 40x40px
  • Type: int
  • Default: 0

最小顔検出範囲。デフォルト値0

1フレームの画像のうち、顔探索するピクセル範囲を決定する変数。
80×80では80X80ピクセル位上の範囲を、40×40 ピクセルでは40X40ピクセル以上の範囲を顔探索します。

1フレームごとにより細かく顔探索するように指示するため、処理時間とトレードオフになります。
下の例ではそれぞれの顔は80X80ピクセルの面積以上になっています。この場合は80×80を選択する(upsampling=0)ことで良好な結果を出します。

mode

  • cnn mode is use model what made from AI model. If you don’t use CUDA, set hog.
  • Type: Type: str
  • Default: hog

顔検出方式。

顔検出にCNN方式または HOG方式のどちらを用いるかを選びます。
CNN: Convolutional Neural Network
HOG: Histogram of Oriented Gradients
CPUのみの場合HOG方式の方が処理速度は高くなります。反対にNvideaのGPUが使える場合、CNN方式の処理速度が高くなります。
( …/dlib/python_examples/dnn_mmod_face_detection_ex.cpp 参照 )

HOG方式はマスクをした顔の検出を苦手とします。
マスクをした顔を顔検出する場合はCNN方式を選択すると良い結果を出します。CNNまたはHOGを指定する際は小文字にして下さい。

frame_skip

  • Specify the number to drop frame. Do not make it less than 2 if use HLS.
  • Type: int
  • Default: 5

フレームドロップの割合。

入力が 30fps の場合 frame_skip=2 では 15fps となります。処理するコンピュータの性能によってさばけるフレーム数は異なります。CPUしか使えない状況でmodeにCNN方式を選んだ時などに負荷がかかって処理速度が落ちる場合、このオプション変数によりフレームを適切にドロップします。

number_of_people

  • Do not ‘analyze’ (Encode and Recognize Process) more than the specified number of people.
  • Type: int
  • Default: 10

use_pipe

  • Use mediapipe for face detection (coordinate calculation) instead of dlib face detection model.
  • Type: bool
  • Default: True

model_selection

  • O OR 1
    • 0: Within 2 meters from the camera,
    • 1: Within 5 meters.
  • NOTE: This value is set only when use_pipe is True.
  • Type: int
  • Default: 1

min_detection_confidence

The minimum confidence value from the face detection model for the detection to be considered successful. If wearing the mask, set it to about 0.3. The lower the number, the higher the possibility of erroneous recognition other than the face. The standard is 0.4 to 0.5.

  • NOTE: You can set person_frame_face_encoding to True only if use_pipe is True.
  • Type: float
  • Default: 0.4

person_frame_face_encoding

  • You can set person_frame_face_encoding to True only if use_pipe is True.
  • Type: bool
  • Default: False

same_time_recognize

  • Number of people to recognize at the same time. Default is 2. Valid only if use_pipe is True.
  • Type: int
  • Default: 2

set_area

  • Zoom. You can select from NONE, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER.
  • Type: Type: str
  • Default: NONE

入力された映像のうち処理する範囲を限定します。入力映像のうち一部分しか使いたくない場合に使用します。デフォルト値NONE

NONE, TOP_LEFT, TOP_RIGHT, CENTER, BOTTOM_LEFT, BOTTOM_RIGHTから指定します。下図のようになります。

set_area=’NONE’
set_area=’CENTER’
set_area=’TOP_LEFT’

movie

  • For test, you can select from bellow.
    • usb (or USB)
      • USB Cam
    • assets/test.mp4 (Only a person.)
    • assets/顔無し区間を含んだテスト動画.mp4
      • Movie file which contain no person frames.
    • rtsp://wowzaec2demo.Type: Type: streamlock.net/vod/mp4:BigBuckBunny_115k.mp4
      • RTSP Type: Type: stream for test.
    • http://219.102.239.58/cgi-bin/camera?resolution=750
      • Live Type: Type: stream using HTTP for test: Live cam at Tokyo.
  • Type: Type: str
  • Default: assets/test.mp4

user

  • User ID for RTSP.
  • Type: str
  • Default: None

passwd

  • User password for RTSP.
  • Type: str
  • Default: None

rectangle

  • Display a legacy face frame on the screen.
  • Type: bool
  • Default: False

顔枠表示指定。顔周囲に枠を描画するかどうか・どの様な枠にするかを指定します。

  • rectangle=True; target_rectangle=False
    四角形を描画する
  • rectangle=False; target_rectangle=True
    通常枠を描画する
  • rectangle=False; target_rectangle=False
    枠を表示しない
  • rectangle=True; target_rectangle=False
  • FACE01 GRAPHICS通常表示
  • rectangle=False; target_rectangle=True
  • rectangle=False; target_rectangle=False
  • target_rectangle

    • Display a modern face frame on the screen
    • NOTE: You can select only one of rectangle or target_rectangle.
    • Type: bool
    • Default: False

    • Display of telop and log
    • Type: bool
    • Default: False

    show_overlay

    • Make the information display on the screen semi-transparent
    • Type: bool
    • Default: False

    alpha

    • Adjust the translucency of ‘overlay
    • Type: float
    • Default: 0.3

    show_percentage

    • Draw similarity in window.
    • Type: bool
    • Default: False

    crop_face_image

    • Save face image.
    • Type: bool
    • Default: True

    frequency_crop_image

    • Save face images per frame to storage.
    • Type: int
    • Default: 5

    n 枚のフレームごとに 1 つの顔画像ファイルを出力することを指定。

    frequency_crop_imageを指定することで運用するマシンのi/o速度がFACE01の処理速度に影響を与えることを抑える効果があると同時にoutputフォルダが顔画像ファイルであふれることを予防します。

    crop_with_multithreading

    • Save face images using multi-threading. If using slower storage, set ‘True’.
    • Type: bool
    • Default: False

    まとめ

    こちらのページもご参照下さい。もし疑問点・不明な点があればお問い合わせからご連絡いただけると幸いです。

    最後までお読み頂きありがとうございました。