---
title: "画像認識のエラー tensorflow KeyError \"The name 'import/input' refers to an Operation not in the graph.\""
description: "簡単に言うと、名前を打ち間違えているので、input が input 間違いになっている、ということです。"
author: "kidneyweakx"
published: 2019-04-07T00:00:00.000Z
updated: 2026-06-02T17:22:05.558Z
lang: ja
tags: ["程式筆記", "Tensorflow"]
canonical: https://kidneyweakx.com/blog/19log-0407-tensor-error?lang=ja
alternate_zh_tw: https://kidneyweakx.com/blog/19log-0407-tensor-error.md
alternate_en: https://kidneyweakx.com/blog/19log-0407-tensor-error.md?lang=en
---

# 画像認識のエラー 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](https://raw.githubusercontent.com/kidneyweakx/img-host/image/image/tensor01.PNG)

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

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

最終的にこの記事にたどり着きました [link](https://developer.arm.com/technologies/machine-learning-on-arm/developer-material/how-to-guides/optimizing-neural-networks-for-mobile-and-embedded-devices-with-tensorflow/determine-the-names-of-input-and-output-nodes)

### **まとめ**

> まず `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
```

出力
![](https://raw.githubusercontent.com/kidneyweakx/img-host/image/image/tensor02.PNG)
