tensorflow / tensorflow/models

[objection_detection] Data augmentation input format scaling confusion

Open
#8,028 1 comment 0 reactions 3 assignees View on GitHub

@pkulzc is already working on this.

Since May 29, 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: not relevant
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.15.0-rc3-22-g590d6ee
  • Bazel version (if compiling from source): not relevant
  • CUDA/cuDNN version: 10.0
  • GPU model and memory: not relevant
  • Exact command to reproduce: not relevant
Describe the problem

Problem concerns data augmentation/preprocessing in Object Detection API.

  1. In inputs.py:
def augment_input_data(tensor_dict, data_augmentation_options):
    tensor_dict[fields.InputDataFields.image] = tf.expand_dims(
      tf.cast(tensor_dict[fields.InputDataFields.image], dtype=tf.float32), 0)

We see that image is being casted to float32, as initially it's uint8 (I double-checked it).
2. Then few lines further image (as a part of tensor_dict is passed to preprocessor.preprocess):

 tensor_dict = preprocessor.preprocess(
      tensor_dict, data_augmentation_options,
  1. Which according to header expects pixel values in [0,1] range (and all augmentation functions as well), but gets [0.0,255.0] since from uint8 only casting happened.
tensor_dict: dictionary that contains images, boxes, and can contain other
                 things as well.
                 images-> rank 4 float32 tensor contains
                          1 image -> [1, height, width, 3].
                          with pixel values varying between [0, 1]

Am I missing something or [0,1] in comments to every function in preprocessor.py is not relevant and it actually deals with [0.0,255.0]

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.