Last active
December 6, 2018 23:31
-
-
Save b0noI/5f578c2f25e3ecd3264be1ab5e660ea0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| import numpy as np | |
| import json | |
| import codecs | |
| img = Image.open("image.jpg").resize((240, 240)) | |
| img_array=np.array(img) | |
| result = { | |
| "instances":[img_array.tolist()] | |
| } | |
| file_path="/tmp/out.json" | |
| json.dump(result, codecs.open(file_path, 'w', encoding='utf-8'), separators=(',', ':'), sort_keys=True, indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment