tensorflow / models

Models and examples built with TensorFlow
Other
77.25k stars 45.75k forks source link

Object detection AttributeError: use_combined_nms #7762

Open hsparrow opened 5 years ago

hsparrow commented 5 years ago

System information

Describe the problem

Previously, I've successfully trained a custom detector with an older version of training executable script but the same configuration, which now failed on tf.contrib. Now I'm trying to reproduce it. The custom detector is based on pre-trained ssd_inception_v2_coco with object detection API, the error AttributeError: use_combined_nms occurs as following traceback shows. No modification to the object_detection/model_main.py script. It seems there is no use_combined_nms attribute set in the postprocessing config.

Source code / logs

Training command:

python3 model_main.py --alsologtostderr --model_dir=training/ --pipeline_config_path=training/ssd_inception_v2_coco.config --num_train_steps=10 --sample_1_of_n_eval_examples=1

Traceback stack

Traceback (most recent call last):
  File "model_main.py", line 105, in <module>
    tf.app.run()
  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/usr/local/lib/python3.7/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "model_main.py", line 101, in main
    tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/training.py", line 473, in train_and_evaluate
    return executor.run()
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/training.py", line 613, in run
    return self.run_local()
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/training.py", line 714, in run_local
    saving_listeners=saving_listeners)
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 370, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1161, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1188, in _train_model_default
    input_fn, ModeKeys.TRAIN))
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1025, in _get_features_and_labels_from_input_fn
    self._call_input_fn(input_fn, mode))
  File "/usr/local/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1116, in _call_input_fn
    return input_fn(**kwargs)
  File "/Users/kk/PycharmProjects/Tensorflow/models/research/object_detection/inputs.py", line 476, in _train_input_fn
    params=params)
  File "/Users/kk/PycharmProjects/Tensorflow/models/research/object_detection/inputs.py", line 542, in train_input
    model_config, is_training=True).preprocess
  File "/Users/kk/PycharmProjects/Tensorflow/models/research/object_detection/builders/model_builder.py", line 634, in build
    add_summaries)
  File "/Users/kk/PycharmProjects/Tensorflow/models/research/object_detection/builders/model_builder.py", line 272, in _build_ssd_model
    ssd_config.post_processing)
  File "/Users/kk/PycharmProjects/Tensorflow/models/research/object_detection/builders/post_processing_builder.py", line 59, in build
    post_processing_config.batch_non_max_suppression)
  File "/Users/kk/PycharmProjects/Tensorflow/models/research/object_detection/builders/post_processing_builder.py", line 91, in _build_non_max_suppressor
    if nms_config.use_combined_nms and nms_config.use_class_agnostic_nms:
AttributeError: use_combined_nms
jllarraz commented 5 years ago

Having the same issue with trainning of mobilenet_v2 and mobilenet_v3. I think itś related to https://github.com/tensorflow/models/pull/6138

pooyadavoodi commented 5 years ago

Which commit of https://github.com/tensorflow/models are you at?

I tested the repo at https://github.com/tensorflow/models/commit/e97e22dfcde0805379ffa25526a53835f887a860 and I could generate an SSD graph.

pooyadavoodi commented 5 years ago

I tried to repro this but I can't find in the directory: training/ssd_inception_v2_coco.config