LoginSignup
0
0

More than 3 years have passed since last update.

初心者が classify_image.py を使おうとしてハマった話

Last updated at Posted at 2020-01-04

IMAGENETの
https://github.com/tensorflow/models/blob/master/tutorials/image/imagenet/classify_image.py
を使おうとしてハマった話です。

環境

・ Ubuntu 18.04

ハマったことと、 対応したこと

$ python classify_image.py

として、そのまま使おうとしても、

AttributeError: module 'tensorflow' has no attribute 'app'

のようなエラーが出て、使えませんでした。
私の環境では、tensorflow の バージョンが 2.0 だったので、以下を実施して、
一旦バージョンを下げました。

$ pip install --upgrade tensorflow==1.13.1

TensorFlow 1.10 では python 3.7 が使えないという話を見かけましたが、
TensorFlow 1.13.1 であれば、一応インストール出来ました。

$ python --version
Python 3.7.0

その後、実行し直してみると、以下のような出力結果が得られました。

giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca (score = 0.89107)
indri, indris, Indri indri, Indri brevicaudatus (score = 0.00779)
lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens (score = 0.00296)
custard apple (score = 0.00147)
earthstar (score = 0.00117)

参考にさせて頂いた URL

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0