I was trying to train the im2txt model using Tensorflow that I just built from master branch,
I downloaded all the data sets it needed but when I run the training script:
bazel-bin/im2txt/train \ --input_file_pattern="${MSCOCO_DIR}/train-?????-of-00256" \ --inception_checkpoint_file="${INCEPTION_CHECKPOINT}" \ --train_dir="${MODEL_DIR}/train" \ --train_inception=false \ --number_of_steps=1000000
It shows the following:
Traceback (most recent call last):
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/train.py", line 111, in tf.app.run()
File "/home/rvl224/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run sys.exit(main(sys.argv[:1] + flags_passthrough))
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/train.py", line 65, in main model.build()
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/show_and_tell_model.py", line 358, in build self.build_inputs()
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/show_and_tell_model.py", line 165, in build_inputs image = self.process_image(encoded_image, thread_id=thread_id)
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/show_and_tell_model.py", line 119, in process_image image_format=self.config.image_format)
File "/home/rvl224/models/im2txt/bazel-bin/im2txt/train.runfiles/im2txt/im2txt/ops/image_processing.py", line 114, in process_image method=tf.image.ResizeMethod.BILINEAR)
TypeError: resize_images() got an unexpected keyword argument 'new_height'
Is it a problem related to the function resize_images() or I just done something wrong?
Thanks
Update: fix applied
Sorry about this! The signature of the function resize_images(...) in TensorFlow was changed last week, which caused this breakage.
I will get a fix in for this shortly. If you would like to use the fix before then, you need to modify the file im2txt/im2txt/ops/image_processing.py.
Simply change this line:
image = tf.image.resize_images(image,
new_height=resize_height,
new_width=resize_width,
method=tf.image.ResizeMethod.BILINEAR)
to this:
image = tf.image.resize_images(image,
size=[resize_height, resize_width],
method=tf.image.ResizeMethod.BILINEAR)
Related
I am trying Intel Low precision Optimization tool and I am following this github(https://github.com/intel/lpot/tree/master/examples/tensorflow/object_detection).When I run the quantization command as below
bash run_tuning.sh --config=ssd_mobilenet_v1.yaml --input_model=ssd_mobilenet_v1_coco_2018_01_28/frozen_inference_graph.pb --output_model=./tensorflow-ssd_mobilenet_v1-tune.pb
I am getting the below error.
Traceback (most recent call last):
File "main.py", line 60, in <module>
evaluate_opt_graph.run()
File "main.py", line 48, in run
quantizer.model = self.args.input_graph
File "/home/uxxxxx/.conda/envs/lpot/lib/python3.7/site-packages/lpot/experimental/component.py", line 334, in model
self._model = Model(user_model)
File "/home/uxxxxx/.conda/envs/lpot/lib/python3.7/site-packages/lpot/experimental/common/model.py", line 43, in __new__
assert False, 'Framework is not detected correctly from model format.'
AssertionError: Framework is not detected correctly from model format.
Please help!
This is because your input model path needs some correction.
Use ./ssd instead of ssd. It worked for me.
Regards
Got this error when trying to use Derrick Schultz's repository for StyleGAN2 neural training in Google Colab https://github.com/dvschultz/ai/blob/master/StyleGAN2_Colab_Train.ipynb
The command were:
!python run_generator.py generate-images --network=/content/drive/My\ Drive/stylegan2-colab-test/stylegan2/results/00002-stylegan2-birdaus-1gpu-config-f/submit_config.pkl --seeds=3875451-3876000 --truncation-psi=0.7
Everything prior were done as in the tutorial but with my own dataset. But then I got:
Local submit - run_dir: results/00006-generate-images
dnnlib: Running run_generator.generate_images() on localhost...
Loading networks from "/content/drive/My Drive/stylegan2-colab-test/stylegan2/results/00002-stylegan2-birdaus-1gpu-config-f/submit_config.pkl"...
Traceback (most recent call last):
File "run_generator.py", line 490, in <module>
main()
File "run_generator.py", line 485, in main
dnnlib.submit_run(sc, func_name_map[subcmd], **kwargs)
File "/content/drive/My Drive/stylegan2-colab-test/stylegan2/dnnlib/submission/submit.py", line 343, in submit_run
return farm.submit(submit_config, host_run_dir)
File "/content/drive/My Drive/stylegan2-colab-test/stylegan2/dnnlib/submission/internal/local.py", line 22, in submit
return run_wrapper(submit_config)
File "/content/drive/My Drive/stylegan2-colab-test/stylegan2/dnnlib/submission/submit.py", line 280, in run_wrapper
run_func_obj(**submit_config.run_func_kwargs)
File "/content/drive/My Drive/stylegan2-colab-test/stylegan2/run_generator.py", line 120, in generate_images
_G, _D, Gs = pretrained_networks.load_networks(network_pkl)
File "/content/drive/My Drive/stylegan2-colab-test/stylegan2/pretrained_networks.py", line 76, in load_networks
G, D, Gs = pickle.load(stream, encoding='latin1')
ValueError: too many values to unpack (expected 3)
This code were supposed to work as is, but doesn't. Unfortunately I'm not a coder myself. What needs to be changed here?
I keep on getting this error with my new training data. I have tried the example data and that works but when I use my own, it gives a "Key Error". The only thing different to my data and the training data is that mine has more classes.
Full Error:
Traceback (most recent call last):
File "object_detection/create_tf_record.py", line 185, in <module>
tf.app.run()
File "C:\Users\edupt\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "object_detection/create_tf_record.py", line 180, in main
image_dir, train_examples)
File "object_detection/create_tf_record.py", line 152, in create_tf_record
tf_example = dict_to_tf_example(data, label_map_dict, image_dir)
File "object_detection/create_tf_record.py", line 97, in dict_to_tf_example
classes.append(label_map_dict[class_name])
KeyError: '300424' <---------- THAT IS THE NAME OF ONE OF THE CLASSES
Tensorflow object detection API using cnn
Traceback (most recent call last):
File "export_inference_graph.py", line 147, in tf.app.run()
File "C:\Users\Ali Salar\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run_sys.exit(main(argv))
File "export_inference_graph.py", line 143, in main
FLAGS.output_directory, input_shape)
File "C:\tensorflow2\models\research\object_detection\exporter.py", line 453, in export_inference_graph
graph_hook_fn=None)
File "C:\tensorflow2\models\research\object_detection\exporter.py", line 421, in _export_inference_graph
placeholder_tensor, outputs)
File "C:\tensorflow2\models\research\object_detection\exporter.py", line 280, in write_saved_model
builder = tf.saved_model.builder.SavedModelBuilder(saved_model_path)
File "C:\Users\Ali Salar\Anaconda3\envs\tensorflow\lib\sit`enter code here`e-packages\tensorflow\python\saved_model\builder_impl.py", line 90, in init
"directory: %s" % export_dir)
AssertionError: Export directory already exists. Please specify a different export directory: inference_graph\saved_model
It's saying the directory already exists. Either change your command in the terminal to point to a new directory or remove everything in this directory that you are currently setting as the output directory.
python3 export_inference_graph.py \
--input_type image_tensor \
--pipeline_config_path YOUR_PIPELINE.CONFIG_FILE_PATH \
--trained_checkpoint_prefix YOUR_MODEL_CHECKPOINT_PATH \
--output_directory exported_graphs/saved_model2
Your try changing output directory.For example exported_graphs/saved_model2 as above.
I am following the below page
https://github.com/tensorflow/models/tree/master/inception
I got to the point I have to run:
bazel-bin/inception/imagenet_train --num_gpus=1 --batch_size=32 --train_dir=/tmp/imagenet_train --data_dir=/tmp/imagenet_data
However, I got below error:
Traceback (most recent call last):
File "/home/demo/anaconda3/envs/tensorflow/models/inception/bazel-bin/inception/imagenet_train.runfiles/inception/inception/imagenet_train.py", line 41, in <module>
tf.app.run()
File "/home/demo/anaconda3/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "/home/demo/anaconda3/envs/tensorflow/models/inception/bazel-bin/inception/imagenet_train.runfiles/inception/inception/imagenet_train.py", line 35, in main
tf.gfile.DeleteRecursively(FLAGS.train_dir)
File "/home/demo/anaconda3/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 420, in delete_recursively
pywrap_tensorflow.DeleteRecursively(compat.as_bytes(dirname), status)
File "/home/demo/anaconda3/envs/tensorflow/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/home/demo/anaconda3/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.FailedPreconditionError: /tmp/imagenet_train
My DATA_DIR is /tmp/imagenet_data from previous step bazel-bin/inception/download_and_preprocess_imagenet "${DATA_DIR}"
But what would be my train_dir? The doc doesn't mention it? Look like an empty folder is incorrect.
For me, it works if I set the path of --train_dir=/tmp. Also, you have the processed dataset in the same directory. The --train_dir and --data_dir should not coincide with each other.
Location of where to place the ImageNet data DATA_DIR=$HOME/imagenet-data
Can you tell me if you are still running into problems after changing the directory?
--train_dir is the path to an empty directory where the model checkpoints and events files are stored as the model is trained.