"docs/vscode:/vscode.git/clone" did not exist on "c12f4734807b57f3d5a27fac91296fe9efdced58"
Commit ce1628a5 authored by jtran064's avatar jtran064 Committed by Neal Wu
Browse files

move exception message to caller loop and skip currupted files

parent bde7ddfb
...@@ -208,11 +208,7 @@ def _process_image(filename, coder): ...@@ -208,11 +208,7 @@ def _process_image(filename, coder):
image_data = coder.png_to_jpeg(image_data) image_data = coder.png_to_jpeg(image_data)
# Decode the RGB JPEG. # Decode the RGB JPEG.
try:
image = coder.decode_jpeg(image_data) image = coder.decode_jpeg(image_data)
except:
print('Unexpected eror while decoding %s' % filename)
raise
# Check that image converted to RGB # Check that image converted to RGB
assert len(image.shape) == 3 assert len(image.shape) == 3
...@@ -265,7 +261,13 @@ def _process_image_files_batch(coder, thread_index, ranges, name, filenames, ...@@ -265,7 +261,13 @@ def _process_image_files_batch(coder, thread_index, ranges, name, filenames,
label = labels[i] label = labels[i]
text = texts[i] text = texts[i]
try:
image_buffer, height, width = _process_image(filename, coder) image_buffer, height, width = _process_image(filename, coder)
except Exception, e:
print (e)
print ('SKIPPED. Unexpected eror while decoding %s' % filename)
continue
example = _convert_to_example(filename, image_buffer, label, example = _convert_to_example(filename, image_buffer, label,
text, height, width) text, height, width)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment