Skip to content

[objection_detection] Data augmentation input format scaling confusion #8028

@apatsekin

Description

@apatsekin

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]

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions