vobecant commited on
Commit ·
3bdb378
1
Parent(s): 004843f
Initial commit.
Browse files
app.py
CHANGED
|
@@ -155,18 +155,12 @@ def predict(input_img):
|
|
| 155 |
input_img = transform(input_img_pil)
|
| 156 |
input_img = torch.unsqueeze(input_img, 0)
|
| 157 |
|
| 158 |
-
print('Loaded and prepaded image.')
|
| 159 |
-
|
| 160 |
with torch.no_grad():
|
| 161 |
segmentation = segment_segmenter(input_img, model, window_size, window_stride).squeeze().detach()
|
| 162 |
-
print('Segmented image.')
|
| 163 |
segmentation_remap = remap(segmentation)
|
| 164 |
-
print('Remapped image.')
|
| 165 |
|
| 166 |
drawing_pseudo = colorize_one(segmentation_remap)
|
| 167 |
-
print('Pseudo colors done.')
|
| 168 |
drawing_cs = map2cs(segmentation_remap)
|
| 169 |
-
print('CS colors done.')
|
| 170 |
|
| 171 |
drawing_cs = transforms.ToPILImage()(drawing_cs).resize(input_img_pil.size)
|
| 172 |
drawing_blend_cs = blend_images(input_img_pil, drawing_cs)
|
|
|
|
| 155 |
input_img = transform(input_img_pil)
|
| 156 |
input_img = torch.unsqueeze(input_img, 0)
|
| 157 |
|
|
|
|
|
|
|
| 158 |
with torch.no_grad():
|
| 159 |
segmentation = segment_segmenter(input_img, model, window_size, window_stride).squeeze().detach()
|
|
|
|
| 160 |
segmentation_remap = remap(segmentation)
|
|
|
|
| 161 |
|
| 162 |
drawing_pseudo = colorize_one(segmentation_remap)
|
|
|
|
| 163 |
drawing_cs = map2cs(segmentation_remap)
|
|
|
|
| 164 |
|
| 165 |
drawing_cs = transforms.ToPILImage()(drawing_cs).resize(input_img_pil.size)
|
| 166 |
drawing_blend_cs = blend_images(input_img_pil, drawing_cs)
|