Created
June 9, 2019 12:55
-
-
Save frogermcs/cd146894962952cf926b928c08ae881e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
VAL_BATCH_DIR = "validation_batch" | |
!mkdir {VAL_BATCH_DIR} | |
# Export batch to *.jpg files with specific naming convention. | |
# Make sure they are exported in the full quality, otherwise the inference | |
# process will return different results. | |
for n in range(32): | |
filename = "n{:0.0f}_true{:0.0f}_pred{:0.0f}.jpg".format( | |
n, | |
true_label_ids[n], | |
tflite_model_pred_simplified[n][0] | |
) | |
img_arr = np.copy(val_image_batch[n]) | |
img_arr *= 255 | |
img_arr = img_arr.astype("uint8") | |
img11 = Image.fromarray(img_arr, 'RGB') | |
img11.save("{}/{}".format(VAL_BATCH_DIR, filename), "JPEG", quality=100) | |
# Create archive with images | |
!tar -zcvf {VAL_BATCH_DIR}.tar.gz {VAL_BATCH_DIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment