I download the models: https://github.com/tensorflow/models
I installed all and I do in directory: /models-master/:
$ protoc object_detection/protos/*.proto --python_out=.
$ export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim
$ python object_detection/builders/model_builder_test.py
All fine, but, If I try do:
https://github.com/tensorflow/models/blob/master/object_detection/g3doc/running_locally.md
First I download annotations and images in directory: /object_detection/ , and I do in directory: /models-master/object_detection/
$ tar -xvf annotations.tar.gz
$ tar -xvf images.tar.gz
$ python create_pet_tf_record.py --data_dir=pwd --output_dir=pwd
In the pipeline I use the "faster_rcnn_resnet101_pets.config" and I changed the next:
fine_tune_checkpoint: "/home/fperez/Descargas/models-master/object_detection/model.ckpt"
I don't know, where the model.ckpt is. The other change is:
"""
train_input_reader: {
tf_record_input_reader {
input_path: "/home/fperez/Descargas/models-master/object_detection/pet_train.record"
}
label_map_path: "/home/fperez/Descargas/models-master/object_detection/data/pet_label_map.pbtxt"
}
eval_config: {
num_examples: 2000
}
eval_input_reader: {
tf_record_input_reader {
input_path: "/home/fperez/Descargas/models-master/object_detection/pet_val.record"
}
label_map_path: "/home/fperez/Descargas/models-master/object_detection/data/pet_label_map.pbtxt"
}
"""
I do in directory: /models-master/
$ python object_detection/train.py --logtostderr --pipeline_config_path=object_detection/ --train_dir=object_detection/
and I had the next error:
"""
Traceback (most recent call last):
File "object_detection/train.py", line 198, in
tf.app.run()
File "/home/fperez/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "object_detection/train.py", line 143, in main
model_config, train_config, input_config = get_configs_from_pipeline_file()
File "object_detection/train.py", line 103, in get_configs_from_pipeline_file
text_format.Merge(f.read(), pipeline_config)
File "/home/fperez/.local/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 125, in read
pywrap_tensorflow.ReadFromStream(self._read_buf, length, status))
File "/usr/lib/python2.7/contextlib.py", line 24, in exit
self.gen.next()
File "/home/fperez/.local/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: object_detection
"""
But, when I do "import object_detection" in python terminal, It works fine. What is it my problem? Sorry for the inconvenience
maybe you should modify 2 place:
1、model.ckpt, you should download from https://github.com/tensorflow/models/blob/master/object_detection/g3doc/detection_model_zoo.md, eg faster_rcnn_resnet101_coco, then point to the model.ckpt in this ;
2、 --pipeline_config_path=xx/faster_rcnn_resnet101_pets.config;
try this
Thanks for the answer. I do this:
And I have the same error:
"""Traceback (most recent call last):
File "object_detection/train.py", line 198, in
tf.app.run()
File "/home/fperez/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "object_detection/train.py", line 143, in main
model_config, train_config, input_config = get_configs_from_pipeline_file()
File "object_detection/train.py", line 103, in get_configs_from_pipeline_file
text_format.Merge(f.read(), pipeline_config)
File "/home/fperez/.local/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 125, in read
pywrap_tensorflow.ReadFromStream(self._read_buf, length, status))
File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/home/fperez/.local/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: object_detection
"""
Sorry for the inconvenience
I see a couple problems here with your code. First, when you execute the script you need to specify the actual name of the config not just the directory, for example:
python object_detection/train.py \
--logtostderr \
--pipeline_config_path=/home/meh/.virtualenvs/project/lib/python2.7/site-packages/tensorflow/models/object_detection/samples/configs/faster_rcnn_resnet101_pets.config \
--train_dir=/home/meh/.virtualenvs/project/models/model/train
So you can see above that the pipeline_config_path includes the file name.
Your next problem seems to be a confusion about ckpt files (I can't blame you...). At some point, tensorflow moved to a new method for saving/loading and naming checkpoint files. They used to be contained in a single file (model.ckpt for example). In more recent versions of tensorflow the single ckpt file has been split into several files. Still, tensorflow can load both types of checkpoint files... the trick is to make your file prefix (the 'name') match the model. So, if your model is called mymodel then mymodel.ckpt would load mymodel.ckpt.index and all other files.
This means, in your config file (faster_rcnn_resnet101_pets.config) your fine-tune model directory, that is looking for model.ckpt should point to where you extracted these files: froezen_inference_graph.pb, graph.pbtxt, model.ckpt.data-00000-of-00001, model.ckpt.index, model.ckpt.meta.
There isn't a bug in object_detection here though (that i'm aware of), because I can confirm that it runs perfectly fine on my local machine.
Thanks for your help. Now I can running with the command:
python object_detection/train.py --logtostderr --pipeline_config_path=object_detection/faster_rcnn_resnet101_pets.config --train_dir=object_detection
And the eval:
python object_detection/eval.py --logtostderr --pipeline_config_path=object_detection/faster_rcnn_resnet101_pets.config --checkpoint_dir=object_detection --eval_dir=object_detection
But, I need to commend in config file the line of fine-tune becouse I have a error. I have the line like this:
fine_tune_checkpoint: "/home/fperez/Descargas/models-master/object_detection/model.ckpt/model.ckpt.index"
But the program have an error:
https://pastebin.com/kZu3TRws
Thanks and sorry for the inconvenience.
Hi @FPerezHernandez92 --- try leaving the ".index" suffix off. Specifically, use:
fine_tune_checkpoint: ".../model.ckpt"
@jch1 Thanks, It works fine.
Thanks @jch1 for helping out. @FPerezHernandez92 , Please submit a pull-request with any documentation improvements that would avoid this problem for others in the future.
Hi. Sorry for my delay. The steps are:
First Download the git source, and after:
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim
python object_detection/builders/model_builder_test.py
cd object_detection/
wget http://www.robots.ox.ac.uk/%7Evgg/data/pets/data/images.tar.gz
wget http://www.robots.ox.ac.uk/%7Evgg/data/pets/data/annotations.tar.gz
tar -xvf annotations.tar.gz
tar -xvf images.tar.gz
python create_pet_tf_record.py --data_dir=pwd--output_dir=pwd
cp samples/configs/faster_rcnn_resnet101_pets.config ./
nano faster_rcnn_resnect101_pets.config
""" I have next config:fine_tune_checkpoint: "./object_detection/faster_rcnn_resnet101_coco_11_06_2017/model.ckpt"
from_detection_checkpoint: true
data_augmentation_options {
random_horizontal_flip {
}
}
}train_input_reader: {
tf_record_input_reader {
input_path: "./object_detection/pet_train.record"
}
label_map_path: "./object_detection/data/pet_label_map.pbtxt"
}eval_config: {
num_examples: 2000
}eval_input_reader: {
tf_record_input_reader {
input_path: "./object_detection/pet_val.record"
}
label_map_path: "./object_detection/data/pet_label_map.pbtxt"
shuffle: false
num_readers: 1
}
"""
wget http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet101_coco_11_06_2017.gz.tar
tar -xvf faster_rcnn_resnet101_coco_11_06_2017.tar.gz
mv faster_rcnn_resnet101_coco_11_06_2017 object_detection/
python object_detection/train.py --logtostderr --pipeline_config_path=object_detection/faster_rcnn_resnet101_pets.config --train_dir=object_detectionpython object_detection/eval.py --logtostderr --pipeline_config_path=object_detection/faster_rcnn_resnet101_pets.config --checkpoint_dir=object_detection --eval_dir=object_detection
tensorboard --logdir=./
Hi,
I followed your example above but encountered the following error, any idea?
(tensorflow) [root@SZX1000358305 models]# python object_detection/eval.py --logtostderr --pipeline_config_path=object_detection/faster_rcnn_resnet101_pets.config --checkpoi nt_dir=object_detection --eval_dir=object_detection
INFO:tensorflow:Scale of 0 disables regularizer.
INFO:tensorflow:Scale of 0 disables regularizer.
INFO:tensorflow:Scale of 0 disables regularizer.
INFO:tensorflow:Scale of 0 disables regularizer.
2017-09-21 16:58:48.674079: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available o n your machine and could speed up CPU computations.
2017-09-21 16:58:48.674136: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available o n your machine and could speed up CPU computations.
2017-09-21 16:58:48.674147: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on y our machine and could speed up CPU computations.
INFO:tensorflow:Restoring parameters from object_detection/model.ckpt-200
INFO:tensorflow:Restoring parameters from object_detection/model.ckpt-200
WARNING:root:The following classes have no ground truth examples: 0
/root/tensorflow/models/object_detection/utils/metrics.py:145: RuntimeWarning: invalid value encountered in true_divide
num_images_correctly_detected_per_class / num_gt_imgs_per_class)
(tensorflow) [root@SZX1000358305 models]# tensorboard --logdir=./
TensorBoard 0.1.6 at http://SZX1000358305:6006 (Press CTRL+C to quit)
W0922 08:31:02.236143 Reloader plugin_event_accumulator.py:303] Found more than one graph event per run, or there was a metagraph containing a graph_def, as well as one or more graph events. Overwriting the graph with the newest event.
W0922 08:31:02.286333 Reloader plugin_event_accumulator.py:311] Found more than one metagraph event per run. Overwriting the metagraph with the newest event.
Cheers, Gang
Hi There,
We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing.
If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.
Most helpful comment
Hi @FPerezHernandez92 --- try leaving the ".index" suffix off. Specifically, use: