Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which config should I use to train model for Android (covert later to .tflite format)? #185

Closed
anonym24 opened this issue Nov 7, 2018 · 13 comments

Comments

@anonym24
Copy link

anonym24 commented Nov 7, 2018

Which config should I use to train model for Android (covert later to .tflite format)?

Tensorflow has TOCO converter (.pb > .tflite)

But what config should I use to train pb file?
ssdlite_mobilenet_v1_coco.config, ssd_mobilenet_v1_300x300_coco14_sync.config or ssd_mobilenet_v1_quantized_300x300_coco14_sync.config?

@anonym24
Copy link
Author

anonym24 commented Nov 7, 2018

Also there is ssd_mobilenet_v2_quantized_coco pretrained model available, but no config for this one

@anonym24
Copy link
Author

anonym24 commented Nov 7, 2018

when using python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_quantized_300x300_coco14_sync.config

ERROR:tensorflow:==================================
Object was never used (type <class 'tensorflow.python.framework.ops.Tensor'>):

@anonym24
Copy link
Author

anonym24 commented Nov 7, 2018

I also tried this project on Ubuntu, faster_rcnn_inception_v2_pets.config works fine (the same for Windows)

but ssd_mobilenet_v1_quantized_300x300_coco14_sync.config fails on both Windows and Ubuntu

Ubuntu error when using ssd_mobilenet_v1_quantized_300x300_coco14_sync.config:

python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_300x300_coco14_sync.config
WARNING:tensorflow:From /home/user/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py:125: main (from __main__) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
W1107 14:10:17.052690 140440119306048 tf_logging.py:125] From /home/user/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py:125: main (from __main__) is deprecated and will be removed in a future version.
Instructions for updating:
Use object_detection/model_main.py.
Traceback (most recent call last):
  File "train.py", line 184, in <module>
    tf.app.run()
  File "/home/user/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/home/user/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 306, in new_func
    return func(*args, **kwargs)
  File "train.py", line 93, in main
    FLAGS.pipeline_config_path)
  File "/media/user/DATA/tensorflow1/models/research/object_detection/utils/config_util.py", line 94, in get_configs_from_pipeline_file
    text_format.Merge(proto_str, pipeline_config)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 536, in Merge
    descriptor_pool=descriptor_pool)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 590, in MergeLines
    return parser.MergeLines(lines, message)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 623, in MergeLines
    self._ParseOrMerge(lines, message)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 638, in _ParseOrMerge
    self._MergeField(tokenizer, message)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField
    merger(tokenizer, message, field)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 837, in _MergeMessageField
    self._MergeField(tokenizer, sub_message)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField
    merger(tokenizer, message, field)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 837, in _MergeMessageField
    self._MergeField(tokenizer, sub_message)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField
    merger(tokenizer, message, field)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 837, in _MergeMessageField
    self._MergeField(tokenizer, sub_message)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField
    merger(tokenizer, message, field)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 837, in _MergeMessageField
    self._MergeField(tokenizer, sub_message)
  File "/home/user/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 730, in _MergeField
    (message_descriptor.full_name, name))
google.protobuf.text_format.ParseError: 163:9 : Message type "object_detection.protos.LearningRate" has no field named "cosine_decay_google".

@Burgomehl
Copy link

Maybe it helps if you do this steps before training: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/exporting_models.md

@anonym24
Copy link
Author

anonym24 commented Nov 8, 2018

@Burgomehl what are you talking about?
this step should be done after training (when you have checkpoints)
all of this described in readme

@Burgomehl
Copy link

Yes it is but ... the models are trained on other versions. You are able to bypass some bugs if you export the model before you train ... And I just saied it could help. I don't know if it truely helps.
You are welcome.

@anonym24
Copy link
Author

anonym24 commented Nov 8, 2018

@Burgomehl it generates .pb files and some other files - you do it after you retrained some pretrained model with your classes

@Burgomehl
Copy link

Take the help or don't.

"Our frozen inference graphs are generated using the v1.8.0 release version of Tensorflow and we do not guarantee that these will work with other versions; this being said, each frozen inference graph can be regenerated using your current version of Tensorflow by re-running the exporter, pointing it at the model directory as well as the corresponding config file in samples/configs. "

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md

@anonym24
Copy link
Author

anonym24 commented Nov 9, 2018

@Burgomehl
it doesn't create different checkpoints
they are the same after conversation
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/exporting_models.md

image

from your link:

image

what is the point using the same copied checkpoints?

@anonym24
Copy link
Author

anonym24 commented Nov 9, 2018

seems the errors are related to memory issues, though I have 6GB GTX 1060GT..

seems it's better to resize all images to 300x300 before training
and play with batch_size value (default 24)

@anonym24
Copy link
Author

anonym24 commented Nov 9, 2018

yes example faster_rcnn_inception_v2_pets had 1 value for batch_size
others had 24

@anonym24 anonym24 closed this as completed Nov 9, 2018
@anonym24
Copy link
Author

anonym24 commented Nov 9, 2018

though it still fails but after some steps now:

tensorflow/models#2034 (comment)

@anonym24
Copy link
Author

training SSD Model works fine with model_train.py on Windows:

#184
tensorflow/models#5719 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants