Models: Training model but get error message - ImportError: No module named inception

Created on 2 Dec 2016  路  4Comments  路  Source: tensorflow/models

Please let us know which model this issue is about (specify the top-level directory)

Hi guys

When i tried to run imagenet_train.py in .../models/inception/inception to train the model, i received this error messages after i run it

" ImportError: No module named inception "

When i checked the code

it said that " import inception " in imagenet_train.py cannot find module inception

Any thoughts would be appreciated

Most helpful comment

The tensorflow installation does not include this model. You have to clone the models repo (this one) and run the scripts from its directory.

All 4 comments

Please include all the information requested in the new issues template.

Similar issue when I run Tensorflow Serving with inception_export.py.

~/serving$ py inception_export.py --checkpoint_dir=inception-v3 --export_dir=inception-export
Traceback (most recent call last):
File "inception_export.py", line 32, in
from inception import inception_model
ImportError: No module named 'inception'

then I found the installation NOT include the "inception model" see https://github.com/tensorflow/models:

Install TF:

Ubuntu/Linux 64-bit, CPU only, Python 3.4

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0rc0-cp34-cp34m-linux_x86_64.whl
sudo pip3 install --upgrade $TF_BINARY_URL

check 1:
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow
... (ok no error)
` import inception Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'inception' from inception import inception Traceback (most recent call last): File "", line 1, in ImportError: No module named 'inception'`

check2:
$ ls /usr/local/lib/python3.4/dist-packages/tensorflow/models/
embedding image __init__.py __pycache__ rnn

So, it seems missing the "model" in "tensorflow-0.12.0rc0-cp34-cp34m-linux_x86_64.whl" ?


update: I have try tensorflow-0.10..whl and tensorflow-0.11..whl still no inception module.
(Someone say it can be solved by rebuild from source of TF. I will try it then report here.)


update: I have get the source from git clone https://github.com/tensorflow/tensorflow
ls tensorflow/models/
embedding image __init__.py rnn
So, the 'inception' is not include in the TF source.
(I will try to add inception manually then see what happens...)


update: Added 'inception model' in the /serving then ~/serving$ py inception_export.py --checkpoint_dir=inception-v3 --export_dir=inception-export

WARNING:tensorflow:tf.op_scope(values, name, default_name) is deprecated, use tf.name_scope(name, default_name, values) WARNING:tensorflow:tf.variable_op_scope(values, name, default_name) is deprecated, use tf.variable_scope(name, default_name, values) WARNING:tensorflow:tf.op_scope(values, name, default_name) is deprecated, use tf.name_scope(name, default_name, values) WARNING:tensorflow:tf.variable_op_scope(values, name, default_name) is deprecated, use tf.variable_scope(name, default_name, values) Traceback (most recent call last): File "inception_export.py", line 170, in <module> tf.app.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/platform/app.py", line 43, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) File "inception_export.py", line 166, in main export() File "inception_export.py", line 80, in export logits, _ = inception_model.inference(images, NUM_CLASSES + 1) File "/home/wei/serving/inception/inception_model.py", line 87, in inference scope=scope) File "/home/wei/serving/inception/slim/inception_model.py", line 87, in inception_v3 scope='conv0') File "/home/wei/serving/inception/slim/scopes.py", line 155, in func_with_args return func(*args, **current_args) File "/home/wei/serving/inception/slim/ops.py", line 234, in conv2d outputs = batch_norm(conv, **batch_norm_params) File "/home/wei/serving/inception/slim/scopes.py", line 155, in func_with_args return func(*args, **current_args) File "/home/wei/serving/inception/slim/ops.py", line 111, in batch_norm collections=moving_collections) File "/home/wei/serving/inception/slim/scopes.py", line 155, in func_with_args return func(*args, **current_args) File "/home/wei/serving/inception/slim/variables.py", line 289, in variable trainable=trainable, collections=collections) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variable_scope.py", line 1024, in get_variable custom_getter=custom_getter) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variable_scope.py", line 850, in get_variable custom_getter=custom_getter) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variable_scope.py", line 346, in get_variable validate_shape=validate_shape) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variable_scope.py", line 331, in _true_getter caching_device=caching_device, validate_shape=validate_shape) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variable_scope.py", line 677, in _get_single_variable expected_shape=shape) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variables.py", line 224, in __init__ expected_shape=expected_shape) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variables.py", line 327, in _init_from_args initial_value(), name="initial_value", dtype=dtype) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/variable_scope.py", line 665, in <lambda> shape.as_list(), dtype=dtype, partition_info=partition_info) TypeError: ones_initializer() got multiple values for argument 'dtype'
It's all I can do but no luck.

锛戯紤days ago...

Thanks 锛氾級

The tensorflow installation does not include this model. You have to clone the models repo (this one) and run the scripts from its directory.

Was this page helpful?
0 / 5 - 0 ratings