tensorflow module not found error
Please go to Stack Overflow for help and support:
http://stackoverflow.com/questions/tagged/tensorflow
Also, please understand that many of the models included in this repository are experimental and research-style code. If you open a GitHub issue, here is our policy:
- It must be a bug, a feature request, or a significant problem with documentation (for small docs fixes please send a PR instead).
- The form below must be filled out.
Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.
System information
- What is the top-level directory of the model you are using:
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
- TensorFlow installed from (source or binary):
- TensorFlow version (use command below):
- Bazel version (if compiling from source):
- CUDA/cuDNN version:
- GPU model and memory:
- Exact command to reproduce:
You can collect some of this information using our environment capture script:
https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh
You can obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
Describe the problem
Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.
Source code / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.
~/projects/models/research$ python object_detection/train.py \
--logtostderr
--pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG}
--train_dir=${PATH_TO_TRAIN_DIR} Traceback (most recent call last): File "object_detection/train.py", line 47, inimport tensorflow as tf File "/usr/local/lib/python2.7/dist-packages/tensorflow/init.py", line 23, in from tensorflow.python import * File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/init.py", line 48, in from tensorflow.python import pywrap_tensorflow File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in _pywrap_tensorflow = swig_import_helper() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) ImportError: /usr/local/lib/python2.7/dist-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
while running train.py and eval.py from tensorflow/models/research/object_detection , it is showing error that tensorflow model couldnot be found. Please guide me regarding this error so that i can successfully run train.py and eval.py.
Sincerely yours,
https://github.com/tensorflow/tensorflow/issues/1711 ?
thanx for kind reply.
Now i solved problem related to tensorflow module error. Now i am facing problem in Object Detection pipeline configuration, and finding proper way to configure and run train module using command
From the tensorflow/models/research/ directory
python object_detection/train.py
--logtostderr
--pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG}
--train_dir=${PATH_TO_TRAIN_DIR}
I will be grateful if you can suggest me the way so that i can put proper path for pipeline_config_path and train_dir.
When i tried python object_detection/train.py
--logtostderr
--pipeline_config_path=${/home/hadoop/projects/models/research/object_detection/samples/configs/faster_rcnn_resnet101_pets.config}
--train_dir=${/home/hadoop/projects/models/research/train}
I got the following error bash: --pipeline_config_path=${/home/hadoop/projects/models/research/object_detection/samples/configs/faster_rcnn_resnet101_pets.config}: bad substitution
Please guide me, so that i can run train and evaluation and get the output
PATH_TO_YOUR_PIPELINE_CONFIG=/home/..../faster_rcnn_resnet101_pets.config PATH_TO_TRAIN_DIR=/home/..../train python object_detection/train.py --logtostderr --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} --train_dir=${PATH_TO_TRAIN_DIR}
You should be able to get some help from stackoverflow for shell syntax problem like this.
now i configured pipeline config path and train dir but agian get new error of no module found about object_detection, but it contains object_detection module in projects/models/research.
what might be the solution for this ?
python object_detection/train.py \
--logtostderr \ --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \ --train_dir=${PATH_TO_TRAIN_DIR}
Traceback (most recent call last):
File "object_detection/train.py", line 49, in
please guide about this error
Please follow the instructions here.
Respected sir,
now for object_detection module , i used the command for python path
But now getting different kinds of error:
python object_detection/train.py \
--logtostderr \ --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \ --train_dir=${PATH_TO_TRAIN_DIR}
INFO:tensorflow:Scale of 0 disables regularizer.
INFO:tensorflow:Scale of 0 disables regularizer.
Traceback (most recent call last):
File "object_detection/train.py", line 167, in
I will be grateful for your great kindness, so that i can fix these error and run the train.py successfully.
sincerely yours
You should use a real local path for your label map(as instructed here) instead of PATH_TO_BE_CONFIGURED.
@pkulzc
I follow exactly as tutorial at:
https://cloud.google.com/blog/big-data/2017/06/training-an-object-detector-using-cloud-machine-learning-engine
Then I got the same error as @chiran7 which is:
NotFoundError: PATH_TO_BE_CONFIGURED/pet_label_map.pbtxt
When I run the command:
gcloud ml-engine jobs submit training `whoami`_object_detection_`date +%s` \
--job-dir=${YOUR_GCS_BUCKET}/train \
--packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz \
--module-name object_detection.train \
--runtime-version 1.2 \
--region us-central1 \
--config object_detection/samples/cloud/cloud.yml \
-- \
--train_dir=${YOUR_GCS_BUCKET}/train \
--pipeline_config_path=${YOUR_GCS_BUCKET}/data/faster_rcnn_resnet101_pets.config
I checked and the pet_label_map.pbtxt is already in my bucket
Hi @AliceDinh,as I mentioned above, you should use a real gs path to replace PATH_TO_BE_CONFIGURED. e.g. gs://your-bucket/train/...
@pkulzc thanks, I modifed the faster_rcnn_resnet101_pets.config file and put PATH_TO_BE_CONFIGURED using absolute path.
I did the following command:
sed -i "s|gs://alicedinh/data/pet_train.record|"gs://alicedinh"/data|g" object_detection/samples/configs/faster_rcnn_resnet101_pets.config
sed -i "s|gs://alicedinh/data/pet_val.record|"gs://alicedinh"/data|g" object_detection/samples/configs/faster_rcnn_resnet101_pets.config
sed -i "s|gs://alicedinh/data/pet_label_map.pbtxt|"gs://alicedinh"/data|g" object_detection/samples/configs/faster_rcnn_resnet101_pets.config
sed -i "s|gs://alicedinh/data/model.ckpt.meta|"gs://alicedinh"/data|g" object_detection/samples/configs/faster_rcnn_resnet101_pets.config
sed -i "s|gs://alicedinh/data/model.ckpt.index|"gs://alicedinh"/data|g" object_detection/samples/configs/faster_rcnn_resnet101_pets.config
sed -i "s|gs://alicedinh/data/model.ckpt.data-00000-of-00001|"gs://alicedinh"/data|g" object_detection/samples/configs/faster_rcnn_resnet101_pets.config
then I upload the faster_rcnn_resnet101_pets.config file to my bucket - the one I modified PATH_TO_BE_CONFIGURED by this command:
gsutil cp object_detection/samples/configs/faster_rcnn_resnet101_pets.config gs://alicedinh/data/faster_rcnn_resnet101_pets.config
Then, I run this command to train:
gcloud beta ml-engine jobs submit training `whoami`_object_detection_`date +%s` \
--job-dir=gs://alicedinh/train \
--packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz \
--module-name object_detection.train \
--runtime-version 1.2 \
--region us-central1 \
--config object_detection/samples/cloud/cloud.yml \
-- \
--train_dir=gs://alicedinh/train \
--pipeline_config_path=gs://alicedinh/data/faster_rcnn_resnet101_pets.config
I met the following error: AttributeError: 'module' object has no attribute 'data' Please help
Your error message isn't informative enough to see anything here. Which commit did you sync to? Currently training on cloud is a bit tricky, you can use this branch with runtime 1.2 for now. The problem with other runtimes will be fixed soon.
@pkulzc
I download models from your branch: https://github.com/pkulzc/models.git
but fail right here
python object_detection/dataset_tools/create_pet_tf_record.py \
--label_map_path=object_detection/data/pet_label_map.pbtxt \
--data_dir=`pwd` \
--output_dir=`pwd`
The error is:
Traceback (most recent call last):
File "object_detection/dataset_tools/create_pet_tf_record.py", line 41, in <module>
from object_detection.utils import dataset_util
ImportError: No module named object_detection.utils
python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config Traceback (most recent call last):
File "train.py", line 50, in <module>
from object_detection.builders import graph_rewriter_builder
ImportError: cannot import name 'graph_rewriter_builder'
graph_rewriter_builder file is present in the directory not sure why there is import error
@Nfekih If you did this (Add Libraries to PYTHONPATH), you don't really need to import sys.
@pkulzc Hi Sir,
I am using anaconda with windows10. Directory in which I am working - C:\Users..\model\models-master\research then I run the the protobuf and pythonpath commands. C:\Users...\model\models-master\research>C:/Users/.../protoc-3.4.0-win32/bin/protoc object_detection/protos/*.proto --python_out=. (It runs successfully with out any error) then i run C:\Users...\model\models-master\research>set PYTHONPATH=$PYTHONPATH:'C:\Users\1010141\Desktop\model\models-master\research':'C:\Users\1010141\Desktop\model\models-master\research\slim' (It runs successfully without any error) C:\Users...\model\models-master\research>cd Object_detection C:\Users...\model\models-master\research\Object_detection>python train.py --logtostderr --train_dir=Training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config
Now the error is coming :
Traceback (most recent call last):
File "train.py", line 49, in
Please advise where I am going wrong
@rahulramesh3321 you should print out your PYTHONPATH to see if it really contains models/research and models/research/slim. Also train.py is deprecated and moved to deprecated/. Please try syncing to HEAD and use model_main.py
sir,
i tried
!python3 legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco_2018_01_28.config
and
!python legacy/train.py
--logtostderr
--train_dir=training
--pipeline_config_path=training\ssd_mobilenet_v1_coco_2018_01_28.config
after running
!export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim in the research directory but getting this error in google colab
Traceback (most recent call last):
File "legacy/train.py", line 49, in
sir, i tried !python3 legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco_2018_01_28.config and !python legacy/train.py --logtostderr --train_dir=training --pipeline_config_path=training\ssd_mobilenet_v1_coco_2018_01_28.config after running !export PYTHONPATH=$PYTHONPATH:
pwd:pwd/slim in the research directory but getting this error in google colab Traceback (most recent call last): File "legacy/train.py", line 49, in from object_detection.builders import dataset_builder ModuleNotFoundError: No module named 'object_detection' please help me resolve this
Hi Ankurs444,
Try using below command in Train.py in the beginning :
import sys sys.path.append("C:\...\Desktop\tf\models\research\") sys.path.append("C:\...\Desktop\tf\models\research\object_detection\utils")
from object_detection.utils import dataset_util from object_detection.builders import dataset_builder from object_detection.builders import graph_rewriter_builder from object_detection.builders import model_builder from object_detection.legacy import trainer from object_detection.utils import config_util
I hope this will resolve the issue.