Skip to content

Image FORMAT check in create_pascal_tf_record.py raises a Value Error if images are stored with .jpg extention.  #10694

Open
@VidyaKamath1089

Description

@VidyaKamath1089

1. The entire URL of the file you are using(https://github.com/tensorflow/models/tree/master/research/object_detection/dataset_tools/create_pascal_tf_record.py

2. Describe the bug

The image format check for jpeg images (@ line number 90 using PIL package) only works if the images are having .jpeg extention and fails if the images have .jpg extention. It would have been great if the code could work for .jpg extention as well since it is also a valid jpeg format. Changing extention of thousands of images from .jpg to .jpeg and then syncing the file names with the corresponding annotation files in .xml is a cubersome process!!!!.

3. Steps to reproduce

A ' value error: Image not in JPEG format ' is raised while creating tfrecord file by using PascalVoc format. However the issue resolves if all images are changed to .jpeg instead of .jpg ( Which is not an easy resolve! ) . The same issue is raised while using model maker library as well. The PIL.Image.Open might be the possible source of this error.

4. Expected behavior

The image format check must work even for images with .jpg extention.

5. Additional context

..

6. System information

Using Google Colab GPU/TPU

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions