bottleneck_path = get_bottleneck_path(image_lists, label_name, index,
bottleneck_dir, category)
if not os.path.exists(bottleneck_path):
print("Creating bottleneck at " + bottleneck_path)
image_path = get_image_path(image_lists, label_name, index, image_dir,
category)
if not gfile.Exists(image_path):
tf.logging.fatal("File does not exist %s", image_path)
After Change
except:
print("Invalid float found, recreating bottleneck")
did_hit_error = True
if did_hit_error:
create_bottleneck_file(bottleneck_path, image_lists, label_name, index, image_dir, category, sess, jpeg_data_tensor, bottleneck_tensor)
with open(bottleneck_path, "r") as bottleneck_file:
bottleneck_string = bottleneck_file.read()
// Allow exceptions to propagate here, since they shouldn"t happen after a fresh creation
bottleneck_values = [float(x) for x in bottleneck_string.split(",")]
return bottleneck_values