object_detection: executing train.py throws ValueError
System information
OS: Linux Ubuntu 16.04 Python: 3.5 TensorFlow version: 1.2.0 tensorflow-gpu installed using pip3
On executing train.py using following command:
python3 object_detection/train.py \
--logtostderr \
--pipeline_config_path=data/ssd_inception_v2_pets.config \
--train_dir=/home/d3/imgs/train
I got the following error:
Traceback (most recent call last):
File "object_detection/train.py", line 199, in
tf.app.run()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "object_detection/train.py", line 195, in main
worker_job_name, is_chief, FLAGS.train_dir)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/models/object_detection/trainer.py", line 159, in train
detection_model = create_model_fn()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/models/object_detection/builders/model_builder.py", line 71, in build
raise ValueError('model_config not of type model_pb2.DetectionModel.')
ValueError: model_config not of type model_pb2.DetectionModel.
I also checked the build method inside object_detection.builders.model_builder module for any issue with model_config argument. print(model_config) command inside the method prints the contents of ssd_inception_v2_pets.config file. However, print(model_pb2.DetectionModel) command inside the build method prints <class 'object_detection.protos.model_pb2.DetectionModel'>
I believe this is a duplicate of https://github.com/tensorflow/models/issues/1597
It looks like python3 support for object_detection is being added here: https://github.com/tensorflow/models/pull/1614
I did a fresh installation of Tensorflow and the Protobuf compiler. That solved the issue.
I did fresh installation but it didnt work for me.
Tensorflow: 1.3.0
libprotoc 3.1.0
Error message:
Traceback (most recent call last):
File "train.py", line 200, in
ilenetV1/Conv2d_9_depthwise/BatchNorm/moving_mean] not available in checkpoint
WARNING:root:Variable [MobilenetV1/Conv2d_9_depthwise/BatchNorm/moving_variance] not available in checkpoint
WARNING:root:Variable [MobilenetV1/Conv2d_9_depthwise/depthwise_weights] not available in checkpoint
WARNING:root:Variable [MobilenetV1/Conv2d_9_pointwise/BatchNorm/beta] not available in checkpoint
WARNING:root:Variable [MobilenetV1/Conv2d_9_pointwise/BatchNorm/gamma] not available in checkpoint
WARNING:root:Variable [MobilenetV1/Conv2d_9_pointwise/BatchNorm/moving_mean] not available in checkpoint
WARNING:root:Variable [MobilenetV1/Conv2d_9_pointwise/BatchNorm/moving_variance] not available in checkpoint
WARNING:root:Variable [MobilenetV1/Conv2d_9_pointwise/weights] not available in checkpoint
Traceback (most recent call last):
File "train.py", line 163, in
how do you get this fixed
I am also facing same issue as @nagrajmss , can anybody tell us about this ?
TypeError: Cannot convert a list containing a tensor of dtype <dtype: 'int32'> to <dtype: 'float32'> (Tensor is: <tf.Tensor 'Preprocessor/stack_1:0' shape=(1, 3) dtype=int32>)
For me Environmental variable problem. after setting it properly. it worked.
For me Environmental variable problem. after setting it properly. it worked.
how fixed it friend? help me please.
how do guys fixed this error If you don't reply i will kill myself
In windows, Try setting the tensorflow models in environmental path.
SET _includepath1="C:\tensorflowmodels"
SET _includepath2="C:\tensorflowmodels\research"
SET _includepath3="C:\tensorflowmodels\research\slim"
SET _includepath4="C:\tensorflowmodels\research\object_detection"
SET _includepath5="C:\tensorflowmodels\research\object_detection\protos"
set PYTHONPATH=%_includepath1%;%_includepath2%;%_includepath3%;%_includepath4%;%_includepath5%
set PATH=%PATH%;PYTHONPATH
set _trainpath="C:\train"
set _configfile="C:\train\pipeline.config"
python "..\tensorflowmodels\research\object_detection\legacy\train.py" --logtostderr --train_dir=%_trainpath% --pipeline_config_path=%_configfile%
In my computer,I did these and fixed this problem in model_builder.py don't use "from protos import model_pb2" use "from object_detection.protos import model_pb2" instead
Its not working ..
(tensorflow) D:\my-work\WiS - alert - 2\models\research\object_detection>python train.py --logtostderr --train_dir= D:/my-work/WiS - alert - 2 /models/research/object_detection/training/ --pipeline_config_path= D:/my-work/WiS - alert - 2 /models/research/object_detection/training/ssd_mobilenet_v1_coco.config
D:\installation\anaconda\envs\tensorflow\lib\site-packages\h5py_init_.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "train.py", line 164, in train_dir is missing.'
AssertionError: train_dir is missing.