EmCustomへのオプション値伝達方法につきまして

50 views
Skip to first unread message

木下裕貴

unread,
Aug 23, 2023, 5:39:48 AM8/23/23
to EDGEMATRIX Stream Toolkit Forum

大変お世話になっております。
AMBLの木下です。

題記の通り、EmCustomへのオプション値伝達方法についてご教示いただけますと幸いです。

■環境
AIBox NX, toolkit v2.3

■やりたいこと
EmCustom (Primary, Secondary) へ、ユーザの設定値を伝達することを考えています。
その実装として、以下のように emi_stream_config.json へ記述しました。

  "pipeline_configuration": {
    ...
    "primary": [
      {
        "nvinfer": {...}
      },
      {
        "emcustom": {
          "custom-lib": "hoge.so",
          "in-place": "true",
          "format": "RGBA",
          "process-interval": 0,
          "options": {"person_class_id": 2},
          "libraries": ["fuga.so"]
        }
      }
    ],
    ...
    }

■手元での症状
上記のような記述とすると、アプリが強制終了し、以下のようなエラーログが得られました。
custom-lib、librariesのメイン処理はコメントアウトしています。

2023-08-23 16:06:52,871  ERROR     VideoAI Configuration Error
2023-08-23 16:06:52,871  ERROR     Failed to configure videoai entities
2023-08-23 16:06:52,873  ERROR     Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/edgestream/controller/videoai.py", line 127, in configure
    stream_config, app_config, peer_connection)
  File "/usr/lib/python3/dist-packages/edgestream/controller/dsprimary.py", line 153, in configure
    options_json = json.dumps(
NameError: name 'json' is not defined

Secondaryのみに配置した場合、dssecondary.py で同じエラーです。

■解決したいこと
① Primary/Secondaryに配置した EmCustomにオプション値を伝達する具体的な実装をご教示願います。
   上記の例ではPrimaryだけですが、Primary & Secondary へのオプション設定を考えています。

   もし、達成のため、こちらの記述から変更が必要な場合は、そちらもご教示いただけますと幸いです。
   https://edgestreamsdk-tutorial.readthedocs.io/en/v2.3/emcustom.html#emcustom-options

② Primary & Secondaryへオプション設定を追加した際の、デバイスコンソールのOption設定から設定できるようにする場合の記述もご教示いただけますと幸いです。
   以下フォーラムの通りでしょうか?
   https://groups.google.com/a/edgematrix.com/g/edgematrixstreamtoolkit/c/yuFjp5ATpU4/m/I_Vu1J0nBAAJ

ts...@edgematrix.com

unread,
Aug 24, 2023, 6:28:02 PM8/24/23
to EDGEMATRIX Stream Toolkit Forum, yuki.kin...@ambl.co.jp
お世話になっております。

> NameError: name 'json' is not defined

EdgeStreamでjsonが見つからなくなっているので、
環境が壊れているようです。

①と②はその通りです。

2023年8月23日水曜日 18:39:48 UTC+9 yuki.kin...@ambl.co.jp:

木下裕貴

unread,
Aug 24, 2023, 10:43:45 PM8/24/23
to EDGEMATRIX Stream Toolkit Forum, ts...@edgematrix.com, 木下裕貴
ご連絡ありがとうございます。承知しました。

こちらの不手際で申し訳ないのですが、toolkit versionと、pip list, dpkg -l バージョンが記述されているファイル等はありますか?
特に動作のコアになるバージョンが分かれば、こちらでDiffを取って修復できるかと考えています。

以下に今回言及した個体の pip3 list を記載しておきます。

:~$ pip3 list | grep json
jsonschema                    2.6.0

:~$ pip3 list
Package                       Version
----------------------------- -------------------
apturl                        0.5.2
asn1crypto                    1.4.0
beautifulsoup4                4.6.0
blessings                     1.6
blinker                       1.4
boto3                         1.4.2
botocore                      1.16.19
Brlapi                        0.6.6
Brotli                        1.0.9
certifi                       2020.12.5
cffi                          1.14.5
chardet                       3.0.4
click                         7.1.2
colorama                      0.3.7
cryptography                  2.4.2
cupshelpers                   1.0
Cython                        0.26.1
dataclasses                   0.8
defer                         1.0.6
distro-info                   0.18ubuntu0.18.04.1
docutils                      0.14
edgematrix-stream-toolkit     2.3.0b4
edgestream                    2.9.5
emisecurity                   2.0.3b0
emitools                      2.3.3b2
feedparser                    5.2.1
Flask                         1.1.2
gpg                           1.10.0
gpustat                       0.6.0
graphsurgeon                  0.4.5
h11                           0.12.0
h2                            3.2.0
hpack                         3.0.0
html5lib                      0.999999999
httplib2                      0.9.2
humanfriendly                 4.4.1
hyperframe                    5.2.0
idna                          2.6
itsdangerous                  1.1.0
Jetson.GPIO                   2.0.8
Jinja2                        2.11.3
jmespath                      0.9.3
jsonschema                    2.6.0
kaitaistruct                  0.8
keyrings.alt                  3.0
language-selector             0.1
lazr.uri                      1.0.3
ldap3                         2.6.1
louis                         3.5.0
lxml                          4.2.1
Mako                          1.0.7
MarkupSafe                    1.0
mitmproxy                     5.0.1
numpy                         1.13.3
olefile                       0.45.1
onboard                       1.4.1
onnx                          1.11.0
paho-mqtt                     1.3.1
passlib                       1.7.4
Pillow                        5.1.0
pip                           21.3.1
ply                           3.11
protobuf                      3.19.6
psutil                        5.4.2
publicsuffix2                 2.20191221
pyasn1                        0.4.8
pycairo                       1.16.2
pycparser                     2.20
pycrypto                      2.6.1
pycryptodomex                 3.4.7
pycups                        1.9.73
pyds                          1.0.1
Pygments                      2.2.0
PyGObject                     3.26.1
pygstc                        0.3.0
pyOpenSSL                     19.0.0
pyparsing                     2.4.7
pyperclip                     1.7.0
pyserial                      3.4
pysmi                         0.2.2
pysnmp                        4.4.3
python-apt                    1.6.5+ubuntu0.2
python-dateutil               2.6.1
python-debian                 0.1.32
pyxdg                         0.25
PyYAML                        3.12
requests                      2.18.4
requests-unixsocket           0.1.5
RestrictedPython              5.0
roman                         2.0.0
ruamel.yaml                   0.16.13
ruamel.yaml.clib              0.2.2
s3transfer                    0.3.3
setuptools                    39.0.1
six                           1.11.0
sortedcontainers              2.1.0
ssh-import-id                 5.7
system-service                0.3
systemd-python                234
tensorrt                      7.1.3.0
torch                         1.7.0
torchvision                   0.8.1
tornado                       6.1
typing-extensions             3.7.4.3
ubuntu-advantage-tools        8001
ubuntu-drivers-common         0.0.0
uff                           0.6.9
unattended-upgrades           0.1
unity-scope-calculator        0.1
unity-scope-chromiumbookmarks 0.1
unity-scope-colourlovers      0.1
unity-scope-devhelp           0.1
unity-scope-firefoxbookmarks  0.1
unity-scope-manpages          0.1
unity-scope-openclipart       0.1
unity-scope-texdoc            0.1
unity-scope-tomboy            0.1
unity-scope-virtualbox        0.1
unity-scope-yelp              0.1
unity-scope-zotero            0.1
urllib3                       1.22
urwid                         2.0.1
wadllib                       1.3.2
webencodings                  0.5
Werkzeug                      1.0.1
wheel                         0.30.0
wsproto                       0.14.1
xkit                          0.0.0
zstandard                     0.12.0


以上

2023年8月25日金曜日 7:28:02 UTC+9 ts...@edgematrix.com:

ts...@edgematrix.com

unread,
Aug 29, 2023, 2:16:39 AM8/29/23
to EDGEMATRIX Stream Toolkit Forum
> 特に動作のコアになるバージョンが分かれば、こちらでDiffを取って修復できるかと考えています。

あらためて確認しましたが、考えてみると、jsonはpythonの標準搭載モジュールなので、
見えなくなったらおかしいですよね。

そこでソースを確認したところ、
primaryとsecondaryの中でEMCustomを使う場合、
optionsの読み出し部分で利用しているjsonがimportされていませんでした。
大変失礼しました。

このバグを修正するにはEDGEMATRIX Streamでのfixが必要なため、
v2.5.1などのパッチリリースでの対応となります。

もしくは、primary/emcustomのシンプルな構成であれば動きますが、
このワークアラウンドは使えそうでしょうか?

2023年8月25日金曜日 11:43:45 UTC+9 yuki.kin...@ambl.co.jp:

木下裕貴

unread,
Aug 29, 2023, 10:07:30 PM8/29/23
to EDGEMATRIX Stream Toolkit Forum, ts...@edgematrix.com
ご回答ありがとうございます。

>もしくは、primary/emcustomのシンプルな構成であれば動きますが、
>このワークアラウンドは使えそうでしょうか?

ご提案いただいたこちらの構成を少々把握できないので、確認させていただけないでしょうか。
以下にOK/NGの記述方法を記載しました。
シンプルな構成とは、■OKを指しますか?

■OK 
    "pipeline_configuration": {
        "input": {...},
        "dsmetatransfer": {...},
        "tracker": {...},
        "emcustom": {
            "custom-lib": "hoge.so",
            "libraries": ["fuga.so"],

            "process-interval": 0,
            "options": {"person_class_id": 2}
        },
        "overlay": {...},
        "aimeta": {...}
    },

■NG
  "pipeline_configuration": {
    ...
    "primary": [
      {
        "nvinfer": {...}
      },
      {
        "emcustom": {
          "custom-lib": "hoge.so",
          "in-place": "true",
          "format": "RGBA",
          "process-interval": 0,
          "options": {"person_class_id": 2},
          "libraries": ["fuga.so"]
        }
      }
    ],
    ...
    }


  "pipeline_configuration": {
    ...
    "secondary": [

      {
        "nvinfer": {...}
      },
      {
        "emcustom": {
          "custom-lib": "hoge.so",
          "in-place": "true",
          "format": "RGBA",
          "process-interval": 0,
          "options": {"person_class_id": 2},
          "libraries": ["fuga.so"]
        }
      }
    ],
    ...
    }

2023年8月29日火曜日 15:16:39 UTC+9 ts...@edgematrix.com:

ts...@edgematrix.com

unread,
Aug 30, 2023, 7:19:33 PM8/30/23
to EDGEMATRIX Stream Toolkit Forum
> シンプルな構成とは、■OKを指しますか?

その通りです。

別の標準的な例で言うと、以下の構成でempycustomをemcustomに置き換えたものになりますが、
emcustomがprimaryやsecondaryという親オブジェクトに入っていない構造であればOKで、
この時は自動的に独立したセカンダリーとして機能します。


2023年8月30日水曜日 11:07:30 UTC+9 yuki.kin...@ambl.co.jp:

木下裕貴

unread,
Aug 30, 2023, 9:06:09 PM8/30/23
to EDGEMATRIX Stream Toolkit Forum, ts...@edgematrix.com
ご回答ありがとうございます。
大変参考になりました。


2023年8月31日木曜日 8:19:33 UTC+9 ts...@edgematrix.com:
Reply all
Reply to author
Forward
0 new messages