Added output information with path to wrong JPEG file (#9555)

* Added output information about wrong JPEG file

* Identation

* Switch from logging.fatal to raising runtime exception
This commit is contained in:
Alexandr Baranezky 2017-05-02 07:59:03 +03:00 committed by Vijay Vasudevan
parent a6fb4cc433
commit e184562ea5

View File

@ -369,9 +369,13 @@ def create_bottleneck_file(bottleneck_path, image_lists, label_name, index,
if not gfile.Exists(image_path):
tf.logging.fatal('File does not exist %s', image_path)
image_data = gfile.FastGFile(image_path, 'rb').read()
bottleneck_values = run_bottleneck_on_image(sess, image_data,
jpeg_data_tensor,
bottleneck_tensor)
try:
bottleneck_values = run_bottleneck_on_image(sess, image_data,
jpeg_data_tensor,
bottleneck_tensor)
except:
raise RuntimeError('Error during processing file %s' % image_path)
bottleneck_string = ','.join(str(x) for x in bottleneck_values)
with open(bottleneck_path, 'w') as bottleneck_file:
bottleneck_file.write(bottleneck_string)