QUEST LOG · April 7, 2019· UPDATED June 2, 2026

画像認識のエラー tensorflow KeyError "The name 'import/input' refers to an Operation not in the graph."

# 最近ぶつかった小さなエラー

python
KeyError: "The name 'import/input' refers to an Operation not in the graph."

1.00
1.00

簡単に言うと、名前を打ち間違えているので、input が input 間違いになっている、ということです。

ネットで調べて "Mul" "input"などいろいろ試しましたが、どれもダメでした。

最終的にこの記事にたどり着きました link ↗

# まとめ

まず tensorflow のツールで .pb を tensorboard で見られる形式に変換し、input_layer(自分の場合は placeholder)と output_layer の名前を調べてから修正します。

自分のコマンドはこれです(必要に応じて変更してください)

python
python tensorflow\examples\label_image\label_image.py --graph=tmp\output_graph.pb --label=tmp\output_labels.txt --image=tmp\91076.png --input_layer=Placeholder --output_layer=final_result

出力

公開中のアプリ

iOS・Android で無料。

AniSeekr

AniSeekr

MAL・AniList・Bangumi など 6 つのサービスの視聴記録をまとめて、作品の聖地も巡れるアニメ伴走アプリ。

Solid(ar)ity

Solid(ar)ity

プライバシー重視の ID ウォレット。ゼロ知識証明と署名付き名刺を対面で交換、中央サーバーなし。