HARK FORUM › 音源定位結果をhark-pythonで扱うには
- This topic has 1 reply, 2 voices, and was last updated 5 years, 11 months ago by
Masayuki Takigahira.
-
AuthorPosts
-
June 13, 2019 at 11:14 am #938
お世話になっております。
画像認識による人物検知とHARKによる音源分離を組み合わせて雑音環境下でも頑強な音声認識ができるようなシステム構築を考えている者です。
具体的には画像認識による話者の位置情報をhark-pythonへと渡し、その後そのデータを音源分離ノードの入力とすることを考えています。現在、まずはhark-pythondからDisplayLocalization等のsource型を入力とするノードにデータを渡せないか練習している段階なのですが、解決できないエラーがございます。
実行時のネットワークファイルを添付いたします。
実行時のpythonファイルは以下のとおりです。# py_source.py from harkpython import harkbasenode class HarkNode(harkbasenode.HarkBaseNode): def __init__(self): self.outputNames=("output",) # one output terminal named "output" self.outputTypes=("prim_source",) # the type is primitive float. def calculate(self): self.outputValues["output"] = self.input print("==========") print(self.input) print("==========") self.outputValues["output"] = self.input[0]
出力されるエラーを一部抜粋します。
RuntimeError: HARK-Middleware: HARK exception thrown at harkmw/src/node.cc:185 (Node_process): /home/user/scripts/packaging/HARK-System/hark-base/src/conversion.cc line 267: Failed to dispatch conversion between N4HARK6SourceE and N4HARK6VectorINS_5RCPtrINS_6ObjectEEEEE /home/user/scripts/packaging/HARK-System/hark-base/src/BufferedNode.cc line 98: Node DisplayLocalization (type 19DisplayLocalization) Exception caught in BufferedNode::getOutput
なにかご存知でしたらご教授頂きたいです。
以上、よろしくお願い致します。Attachments:
June 14, 2019 at 6:53 pm #953お問い合わせありがとうございます。
DisplayLocalization
ノード等へ入力されていますので、PyCodeExecutor3
ノードの出力はVector<Source>
型になっていなければなりません。全てのノードについて入出力の型が掲載されていますので、詳細はHARK-Documentのノードリファレンスをご参照ください。つまり、今回のケースは出力端子の型設定を
self.outputTypes=("prime_source",)
ではなく
self.outputTypes=("vector_source",)
と設定する必要が御座います。それに伴い
self.outputValues["output"] = self.input[0]
と書かれている行についても次のようにする必要が御座います。
self.outputValues["output"] = [self.input[0]]
更に、入力されたVectorサイズが0である(定位無しの)可能性が御座いますので、次のようにしていなければ実行中にクラッシュする可能性が御座います。
self.outputValues["output"] = [] if len(self.input)<1 else [self.input[0]]
また、余談ですが
self.outputValues["output"] = self.input self.outputValues["output"] = self.input[0]
のように同一出力端子に2度書き込みを行った場合、
後で書き込まれた値のみが使われます。
calculate()
メソッドを抜ける時点で設定した型と
最終的に書き込まれている型が不一致している場合には
エラーが発生しますのでご注意ください。以上、よろしくお願い致します。
-
This reply was modified 5 years, 11 months ago by
Masayuki Takigahira.
-
This reply was modified 5 years, 11 months ago by
Masayuki Takigahira.
-
This reply was modified 5 years, 11 months ago by
Masayuki Takigahira.
-
AuthorPosts
- You must be logged in to reply to this topic.