Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Updated:

Question

How to normalize images when converting AI models.

...

Answer

Can be set with IN_MEAN and IN_SCALE in setting.conf file.

...

  • IN_MEAN : Parameters for subtractive normalization

    • Values that have an average of 0 (For 0-255, it is 127.5)

    • If the values are different in RGB, enter them separated by commas without spaces. (103.94,116.78,123.68)

  • IN_SCALE:除算正規化を行う場合のパラメータ

    • 分散が1となるような値(0-255の場合、255)

上記のパラメータを指定して正規化を行った場合、
  減算(IN_MEAN) ⇒ 除算(IN_SCALE)⇒ 推論
の順で処理が行われます。(標準化)

上記以外の手順で正規化を行いたい場合は、前処理スクリプトを作成し、”PREPRO”に設定してください。

Info

“PREPRO”に指定した前処理はモデルファイルには含まれないため、モデルをアプリに組み込む場合は、アプリ側にも前処理を実装してください。

設定例:

  • 0 - 255 を 0SCALE : Parameters for division normalization

    • Value that gives a variance of 1 (For 0-255, it is 255)

If normalization is performed with the above parameters specified, processing is performed in the following order. (Standardization)
subtraction (IN_MEAN) ⇒ division (IN_SCALE) ⇒ inference
If you want to normalize using a procedure other than the above, create a preprocessing script and set it to "PREPRO".

Info

The preprocessing specified as "PREPRO" is not included in the model file. If you incorporate the model into your app, implement preprocessing on the app side as well.

Setting Example :

  • When normalizing 0 - 255 to 0.0 - 1.0 に正規化する場合:0 :

    • IN_MEAN:0MEAN : 0

    • IN_SCALE:255SCALE : 255

  • When normalizing 0 - 255 を 255 to -1.0 - 1.0 に正規化する場合:0 :

    • IN_MEAN:127MEAN : 127.5

    • IN_SCALE:127SCALE : 127.5

  • 前処理スクリプトで正規化を行う場合(変換後モデルに前処理を含めない):When normalization is performed in the preprocessing script (Not include preprocessing in post-conversion model):

    • IN_MEAN:0MEAN : 0

    • IN_SCALE:1PREPRO:前処理スクリプトパスSCALE : 1

    • PREPRO : Preprocessing script path

Info

詳細は、CVツールに同梱されている「AdamAppFor details, refer to "AdamApp_CVtool_UserManual_Vx_xx.pdf」を参照してください。pdf" included with the CV tool.