Update example_inference.py
Browse files- example_inference.py +3 -3
example_inference.py
CHANGED
|
@@ -28,10 +28,10 @@ def example_inference():
|
|
| 28 |
result_image = postprocess_image(result[0][0], orig_im_size)
|
| 29 |
|
| 30 |
# save result
|
| 31 |
-
|
| 32 |
-
no_bg_image = Image.new("RGBA", pil_im.size, (0,0,0,0))
|
| 33 |
orig_image = Image.open(im_path)
|
| 34 |
-
no_bg_image
|
|
|
|
| 35 |
no_bg_image.save("example_image_no_bg.png")
|
| 36 |
|
| 37 |
|
|
|
|
| 28 |
result_image = postprocess_image(result[0][0], orig_im_size)
|
| 29 |
|
| 30 |
# save result
|
| 31 |
+
pil_mask_im = Image.fromarray(result_image)
|
|
|
|
| 32 |
orig_image = Image.open(im_path)
|
| 33 |
+
no_bg_image = orig_image.copy()
|
| 34 |
+
no_bg_image.putalpha(pil_mask_im)
|
| 35 |
no_bg_image.save("example_image_no_bg.png")
|
| 36 |
|
| 37 |
|