tensorflow / tensorflow/models

Bug: if input_config.WhichOneof('input_reader') == 'tf_record_input_reader': AttributeError: 'list' object has no attribute 'WhichOneof'

Open
#5,924 14 comments 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since Jul 1, 2020.

models:research:odapi type:bug
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

System information
  • What is the top-level directory of the model you are using: tensorflow/models/research/object_detection
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No, using stock from git
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux 4.19.8-arch1-1-ARCH Antergos
  • Python version: Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44)
  • TensorFlow installed from (source or binary): N/A
  • TensorFlow version (use command below): 1.12
  • Bazel version (if compiling from source): N/A
  • CUDA/cuDNN version: 10.0/7.4
  • GPU model and memory: Nvidia Quadro K2100M 2GB
  • Exact command to reproduce:
python object_detection/metrics/offline_eval_map_corloc.py metrics/offline_eval_map_corloc.py --eval_dir=/home/user/PycharmProjects/SomeProject/eval_metrics --eval_config_path=/home/user/PycharmProjects/SomeProject/config/test_eval_config.pbtxt --input_config_path=/home/user/PycharmProjects/SomeProject/config/test_input_config.pbtxt
Describe the problem

Getting error if input_config.WhichOneof('input_reader') == 'tf_record_input_reader': AttributeError: 'list' object has no attribute 'WhichOneof' while trying to run the Computing evaluation measures example from https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/oid_inference_and_evaluation.md

also fixed a typo line 162 offline_eval_map_corloc.py input_config = configs['eval_input_configs'] (eval_input_configs), at least for coco_metrics

Source code / logs

Traceback

/home/user/anaconda3/envs/tensorflow_gpuenv/bin/python /opt/JetBrains/apps/PyCharm-P/ch-0/183.4284.139/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 35603 --file /home/user/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/models/research/object_detection/metrics/offline_eval_map_corloc.py --eval_dir=/home/user/PycharmProjects/SomeProject/eval_metrics --eval_config_path=/home/user/PycharmProjects/SomeProject/config/test_eval_config.pbtxt --input_config_path=/home/user/PycharmProjects/SomeProject/config/test_input_config.pbtxt
pydev debugger: process 6999 is connecting

Connected to pydev debugger (build 183.4284.139)
/home/user/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/models/research/object_detection/utils/visualization_utils.py:26: UserWarning: matplotlib.pyplot as already been imported, this call will have no effect.
  import matplotlib; matplotlib.use('Agg')  # pylint: disable=multiple-statements
Traceback (most recent call last):
  File "/opt/JetBrains/apps/PyCharm-P/ch-0/183.4284.139/helpers/pydev/pydevd.py", line 1689, in <module>
    main()
  File "/opt/JetBrains/apps/PyCharm-P/ch-0/183.4284.139/helpers/pydev/pydevd.py", line 1683, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/opt/JetBrains/apps/PyCharm-P/ch-0/183.4284.139/helpers/pydev/pydevd.py", line 1083, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/opt/JetBrains/apps/PyCharm-P/ch-0/183.4284.139/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/user/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/models/research/object_detection/metrics/offline_eval_map_corloc.py", line 171, in <module>
    tf.app.run(main)
  File "/home/user/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/home/user/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/models/research/object_detection/metrics/offline_eval_map_corloc.py", line 164, in main
    metrics = read_data_and_evaluate(input_config, eval_config)
  File "/home/user/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/models/research/object_detection/metrics/offline_eval_map_corloc.py", line 91, in read_data_and_evaluate
    if input_config.WhichOneof('input_reader') == 'tf_record_input_reader':
AttributeError: 'list' object has no attribute 'WhichOneof'

Process finished with exit code 1

Contents of test_eval_config.pbtxt

metrics_set: 'coco_detection_metrics'

Contents of test_input_config.pbtxt

label_map_path: "/home/user/PycharmProjects/SomeProject/config/mscoco_label_map.pbtxt"

tf_record_input_reader: {
    input_path: "/home/user/PycharmProjects/SomeProject/eval/detections.tfrecord"
}

If more info is needed please don't hesitate,
Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.