tensorflow / tensorflow/models

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

Open
#10,694 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

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.

Research direction

Start in research/object_detection/dataset_tools/create_pascal_tf_record.py around line 90 and reproduce the Pascal VOC conversion with images using the .jpg extension. Inspect the PIL-based format check and any related tests; done means valid JPEG images with either .jpg or .jpeg extensions are accepted without changing annotation filenames.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.