vobecant
commited on
Commit
·
4eed812
1
Parent(s):
d4c3a41
Initial commit.
Browse files- .idea/workspace.xml +9 -2
- app.py +6 -0
.idea/workspace.xml
CHANGED
|
@@ -50,7 +50,7 @@
|
|
| 50 |
<option name="number" value="Default" />
|
| 51 |
<option name="presentableId" value="Default" />
|
| 52 |
<updated>1647350746642</updated>
|
| 53 |
-
<workItem from="1647350750956" duration="
|
| 54 |
</task>
|
| 55 |
<task id="LOCAL-00001" summary="Initial commit.">
|
| 56 |
<created>1647352693910</created>
|
|
@@ -220,7 +220,14 @@
|
|
| 220 |
<option name="project" value="LOCAL" />
|
| 221 |
<updated>1647358886682</updated>
|
| 222 |
</task>
|
| 223 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
<servers />
|
| 225 |
</component>
|
| 226 |
<component name="TypeScriptGeneratedFilesManager">
|
|
|
|
| 50 |
<option name="number" value="Default" />
|
| 51 |
<option name="presentableId" value="Default" />
|
| 52 |
<updated>1647350746642</updated>
|
| 53 |
+
<workItem from="1647350750956" duration="8171000" />
|
| 54 |
</task>
|
| 55 |
<task id="LOCAL-00001" summary="Initial commit.">
|
| 56 |
<created>1647352693910</created>
|
|
|
|
| 220 |
<option name="project" value="LOCAL" />
|
| 221 |
<updated>1647358886682</updated>
|
| 222 |
</task>
|
| 223 |
+
<task id="LOCAL-00025" summary="Initial commit.">
|
| 224 |
+
<created>1647358970013</created>
|
| 225 |
+
<option name="number" value="00025" />
|
| 226 |
+
<option name="presentableId" value="LOCAL-00025" />
|
| 227 |
+
<option name="project" value="LOCAL" />
|
| 228 |
+
<updated>1647358970013</updated>
|
| 229 |
+
</task>
|
| 230 |
+
<option name="localTasksCounter" value="26" />
|
| 231 |
<servers />
|
| 232 |
</component>
|
| 233 |
<component name="TypeScriptGeneratedFilesManager">
|
app.py
CHANGED
|
@@ -134,12 +134,18 @@ def predict(input_img):
|
|
| 134 |
input_img = transform(input_img)
|
| 135 |
input_img = torch.unsqueeze(input_img, 0)
|
| 136 |
|
|
|
|
|
|
|
| 137 |
with torch.no_grad():
|
| 138 |
segmentation = segment_segmenter(input_img, model, window_size, window_stride).squeeze().detach()
|
|
|
|
| 139 |
segmentation_remap = remap(segmentation)
|
|
|
|
| 140 |
|
| 141 |
drawing_pseudo = colorize_one(segmentation_remap)
|
|
|
|
| 142 |
drawing_cs = map2cs(segmentation_remap)
|
|
|
|
| 143 |
|
| 144 |
# drawing_pseudo = transforms.ToPILImage()(drawing_pseudo)
|
| 145 |
drawing_cs = transforms.ToPILImage()(drawing_cs)
|
|
|
|
| 134 |
input_img = transform(input_img)
|
| 135 |
input_img = torch.unsqueeze(input_img, 0)
|
| 136 |
|
| 137 |
+
print('Loaded and prepaded image.')
|
| 138 |
+
|
| 139 |
with torch.no_grad():
|
| 140 |
segmentation = segment_segmenter(input_img, model, window_size, window_stride).squeeze().detach()
|
| 141 |
+
print('Segmented image.')
|
| 142 |
segmentation_remap = remap(segmentation)
|
| 143 |
+
print('Remapped image.')
|
| 144 |
|
| 145 |
drawing_pseudo = colorize_one(segmentation_remap)
|
| 146 |
+
print('Pseudo colors done.')
|
| 147 |
drawing_cs = map2cs(segmentation_remap)
|
| 148 |
+
print('CS colors done.')
|
| 149 |
|
| 150 |
# drawing_pseudo = transforms.ToPILImage()(drawing_pseudo)
|
| 151 |
drawing_cs = transforms.ToPILImage()(drawing_cs)
|