tensorflow / tensorflow/models

eager_eval_loop() fails to loop over dataset

Open
#10,394 0 comments 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since Nov 25, 2021.

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

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [Y] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • [Y] I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • [Y] I checked to make sure that this issue has not already been filed.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/blob/master/research/object_detection/model_lib_v2.py

2. Describe the bug

I am new to tensorflow and have been tasked with updating some old code at my company from tf1 to tf2. When trying to run eval_continuously() on a model from the model zoo that I trained using train_loop(), a DatasetV1Adapter is created (Line 1115) and is passed into eager_eval_loop() at which point, an attempt is made to enumerate the DatasetV1Adapter (Line 928) and loop over the result. However, the enumeration returns an empty list, and the loop is never run. As a result, no evaluators can be created, and looping over them later in the function throws an error.

3. Steps to reproduce

  • Download the faster_rcnn_inception_resnet_v2_640x640_coco17_tpu-8 model from the tf2 model zoo
  • Train a model using the train_loop() function
  • Run eval_continuously with the checkpoints created in the training

4. Expected behavior

The eval_continuously() function should run successfully and should not throw any errors.

5. Additional context

Result when I print the DatasetV1Adapter:
<DatasetV1Adapter shapes: ({image: (1, 640, 640, 3), hash: (1,), true_image_shape: (1, 3), original_image_spatial_shape: (1, 2), original_image: (1, 640, 640, 3)}, {num_groundtruth_boxes: (1,), groundtruth_boxes: (1, 100, 4), groundtruth_classes: (1, 100, 1), groundtruth_weights: (1, 100), groundtruth_confidences: (1, 100, 1), groundtruth_area: (1, 100), groundtruth_is_crowd: (1, 100), groundtruth_group_of: (1, 100), groundtruth_difficult: (1, 100), groundtruth_verified_neg_classes: (1, 1), groundtruth_not_exhaustive_classes: (1, 1)}), types: ({image: tf.float32, hash: tf.int32, true_image_shape: tf.int32, original_image_spatial_shape: tf.int32, original_image: tf.uint8}, {num_groundtruth_boxes: tf.int32, groundtruth_boxes: tf.float32, groundtruth_classes: tf.float32, groundtruth_weights: tf.float32, groundtruth_confidences: tf.float32, groundtruth_area: tf.float32, groundtruth_is_crowd: tf.bool, groundtruth_group_of: tf.bool, groundtruth_difficult: tf.int32, groundtruth_verified_neg_classes: tf.float32, groundtruth_not_exhaustive_classes: tf.float32})>

Error Traceback:

  File "/home/tensorflow/.local/bin/ml-trainer", line 8, in <module>
    sys.exit(run())
  File "/home/tensorflow/.local/lib/python3.6/site-packages/ml_trainer/app.py", line 83, in run
    runner.run()
  File "/home/tensorflow/.local/lib/python3.6/site-packages/kafka_runner/__init__.py", line 209, in run
    topic_message_pairs = handler.handle(parsed_value)
  File "/home/tensorflow/.local/lib/python3.6/site-packages/ml_trainer/ml_trainer.py", line 332, in handle
    self.train_model(output_directory, pipeline_config_path, train_steps, sample_1_of_n, one_of_n_train, events_dir)
  File "/home/tensorflow/.local/lib/python3.6/site-packages/ml_trainer/ml_trainer.py", line 434, in train_model
    wait_interval=300
  File "/home/tensorflow/models/research/object_detection/model_lib_v2.py", line 1161, in eval_continuously
    global_step=global_step,
  File "/home/tensorflow/models/research/object_detection/model_lib_v2.py", line 1005, in eager_eval_loop
    for evaluator in evaluators:
TypeError: 'NoneType' object is not iterable
Exception ignored in: <bound method Minio.__del__ of <minio.api.Minio object at 0x7fdfeb2fa860>>
Traceback (most recent call last):
  File "/home/tensorflow/.local/lib/python3.6/site-packages/minio/api.py", line 155, in __del__
  File "/usr/local/lib/python3.6/dist-packages/urllib3/poolmanager.py", line 222, in clear
  File "/usr/local/lib/python3.6/dist-packages/urllib3/_collections.py", line 100, in clear
  File "/usr/local/lib/python3.6/dist-packages/urllib3/poolmanager.py", line 173, in <lambda>
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 494, in close
TypeError: catching classes that do not inherit from BaseException is not allowed```

## 6. System information

- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
- Mobile device name if the issue happens on a mobile device: N/A
- TensorFlow installed from (source or binary): Pre-installed on the tensorflow/tensorflow:2.6.0 docker image
- TensorFlow version (use command below): 2.6.0
- Python version: 3.6.9
- Bazel version (if compiling from source): N/A
- GCC/Compiler version (if compiling from source): N/A
- CUDA/cuDNN version: N/A (running on cpu)
- GPU model and memory: N/A (running on cpu)

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.