Corrupt JPEG data: 245 extraneous bytes before marker 0xd9
System information
- What is the top-level directory of the model you are using: tensorflow/models
- 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): Windows 10 x64
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): 1.2.1
- Bazel version (if compiling from source):
- CUDA/cuDNN version: 8.0 / 5.1
- GPU model and memory: GeForce GTX 1060 6GB
- Exact command to reproduce: python object_detection\eval.py --logtostderr --checkpoint_dir=C:\Users\TVS\tensorflow\models\out\ --eval_dir=C:\Users\TVS\tensorflow\models\eval\ --pipeline_config_path=C:\Users\TVS\tensorflow\models\object_detection\samples\configs\faster_rcnn_resnet101_pets.config
Describe the problem
When training the Oxford-IIIT Pet Dataset from Scratch (without any finetune checkpoint from COCO set), I get the following error message while running the eval.py script:
Corrupt JPEG data: 245 extraneous bytes before marker 0xd9
I have build the TFRecord files with the script provided in the object detection api, but get the same for an PASCAL VOC like own dataset. I saw some guys having similar problems related to libjpeg, could it be that this error is related to libjpeg?
I am sure that my TFRecords are valid, because I can reconstruct valid Image and Annotation data from it.
Since I did not write any own code I suspect this to be a Bug.
/CC @tombstone
I got this error too, I also tested all the images and they were good. Something fishy in the jpeg encoder/decoder ?
I got exactly the same the error on Ubuntu 14.04. Have you solved it? @RobinBaumann @Mistobaan
im guessing you all used the generate_tf_record_pet python script to create the record files?
if so, i believe this error is caused by setting image/format on
'image/format': dataset_util.bytes_feature
originally it is hardcoded to set to JPEG, however I also had PNGs, so it failed when running on cloud, i switch this dynamically determine which image format. `byte_flag = 'jpeg'
if '.png' in os.path.basename(img_path): byte_flag = 'png'`
I received this message when I used a Logitech 270, but this doesn't happen with others web cams neither default web cam.
Make sure when you extract the images from the camera you set the image/format correctly in tf record
In the pet data set, there is no png files, but only jpeg files. It seems there is still no valid solution from the discussion so far. Any one has any working solutions?
@ybsave the solution would be to dynamically check the image/format, instead of having `byte_flag = 'jpeg' always set to JPEG
but if we are referring to only the pet dataset, than no issues. people only experience issues when trying to use with other datasets.
@ybsave are you having the issue using only the pet data set and their annotations? or did you add/modify any additional annotations or images?
I have exactly the same issue when working on the pet data set. I have not work on other data sets yet. I use the official demo codes for tfrecord generation, training, and testing. No change at any parts.
It shows: "Corrupt JPEG data: 245 extraneous bytes before marker 0xd9"
After a while, it shows:"RuntimeWarning: invalid value encountered in true_divide num_images_correctly_detected_per_class / num_gt_imgs_per_class)"
I had the same error with the pet dataset, but it is now working. I first went through the images folder and found that the following files had the .jpg extension but were actually .png files:
egyptian_mau_14, 139, 145, 156, 167, 177, 186, 191; abyssinian_5, 34.
I still had the error after deleting these files and .xml data. After running "jpeginfo" in the images folder I found that chihuahua_121 and beagle_116 were also corrupted, even though they displayed correctly. I deleted these files as well and then rebuilt the tfrecords as explained in the tutorial. The corrupt jpeg error does not display now and everything seems to be working.
Removed the above files @gpeier mentioned. Still getting:
Corrupt JPEG data: 240 extraneous bytes before marker 0xd9
I also removed the .xmls and the entries in list.txt, test.txt, and trainval.txt. I am very to new to tensorboard so I really can't tell if those were necessary steps. Also, consider installing jpeginfo and running it in the images folder and then checking to see if you missed any corrupt jpegs.
I would recommend setting a “try and except” statement on the specific line or whatever means to narrow down what file is causing that issue. Could be caused by JPG instead of JPEG or PNG. How did you acquire the images you are trying to train. Many people who download images from google via some script, always end up with corrupted or bad images with wrong extensions
Images are from the oxford/pets website as described in the tutorial. I suspect that either some files in the archive were already corrupted or were corrupted during download. Definitely not a fast download considering I only got 500kb/s on a 1000mb/s google fiber connection.
I confirmed that there is no download problem, too. It seems that the problem is the pet data set's own problem.
I got this error when running eval.py on pet_val.record generated by create_pet_tf_record.py
2017-12-07 15:07:10.069475: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-12-07 15:07:10.069513: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-12-07 15:07:10.069523: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-12-07 15:07:10.069531: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. INFO:tensorflow:Restoring parameters from /Users/visethsean/Downloads/models-master/research/object_detection/models/model/train/model.ckpt-0 INFO:tensorflow:Restoring parameters from /Users/visethsean/Downloads/models-master/research/object_detection/models/model/train/model.ckpt-0 Corrupt JPEG data: 240 extraneous bytes before marker 0xd9
Is there anyone already solved the problem?
I am able to reproduce this problem. Can't figure out and waiting for answer.
during train, I noticed "Corrupt JPEG data: premature end of data segment" in middle of training steps