bottleneck_values = run_bottleneck_on_image(sess, image_data,
jpeg_data_tensor,
bottleneck_tensor)
bottleneck_string = ",".join(str(x) for x in bottleneck_values)
with open(bottleneck_path, "w") as bottleneck_file:
bottleneck_file.write(bottleneck_string)
with open(bottleneck_path, "r") as bottleneck_file:
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