-
Notifications
You must be signed in to change notification settings - Fork 1.1k
how to save image_data with bounding boxes as '.jpg' in object_detection task #340
Comments
I know already.We can use |
Hi @erinliu0428! This is definitely missing from from PIL import Image
Image.fromarray(img.pixel_data).save('test.jpg') I will leave this open and mark it as a feature request, since there should be an even simpler way. |
@gustavla Thank you for your attention ! |
* added save functionality to the src/unity/python/turicreate/data_structures/image.py Image class * sharing code in save by calling _to_pil_image
Fixed by #709 |
@znation Thank you very much for your reply in #88 for "save the images at full size"; but when I tried the code: Is there any other things that I should do in advance? |
Hi @baizhenmao95, in the code examples there, from PIL import Image
# note the [0] - this extracts just the first image from the SArray
Image.fromarray(img[0].pixel_data).save('test.jpg') Or, you could run a lambda function over the SFrame to save all images in parallel. For this, you would need another SArray containing the desired filename (let's assume it's called "filename"): from PIL import Image
# make a temporary SFrame to associate images with filenames
temp_sf = tc.SFrame()
temp_sf["img"] = img
temp_sf["filename"] = filename
temp_sf.apply(lambda row: Image.fromarray(row["img"].pixel_data).save(row["filename"])) |
Wow, that's cool! Thank you very much! I'll try it. |
In the object_detection task, we use
data['image_with_ground_truth'] = tc.object_detector.util.draw_bounding_boxes(data['image'], data['annotations'])
to create a turicreate.Image type data which contains image data with bounding boxes. So how to save the turicreate.Image type data as '.jpg' or '.png' ? The file '~/turicreate/data_structures/image.py ' doesn't have a function like this
The text was updated successfully, but these errors were encountered: