Spaces:
Runtime error
Runtime error
sfmig
commited on
Commit
·
272aa37
1
Parent(s):
6c333c9
added seaborn
Browse files- app.py +4 -1
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -9,6 +9,8 @@ https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/
|
|
| 9 |
|
| 10 |
https://arxiv.org/abs/2005.12872
|
| 11 |
|
|
|
|
|
|
|
| 12 |
Additions
|
| 13 |
- add shown labels as strings
|
| 14 |
- show only animal masks (ask an nlp model?)
|
|
@@ -19,6 +21,7 @@ For next time
|
|
| 19 |
- Im getting core dumped (segmentation fault) when loading hugging face model.. :()
|
| 20 |
https://github.com/huggingface/transformers/issues/16939
|
| 21 |
- cap slider to 95?
|
|
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
from transformers import DetrFeatureExtractor, DetrForSegmentation
|
|
@@ -61,7 +64,7 @@ def predict_animal_mask(im,
|
|
| 61 |
# color_mask[label_per_pixel==lbl,:] = color
|
| 62 |
|
| 63 |
# Show image + mask
|
| 64 |
-
pred_img = np.array(image.convert('RGB'))*0.
|
| 65 |
pred_img = pred_img.astype(np.uint8)
|
| 66 |
|
| 67 |
return pred_img
|
|
|
|
| 9 |
|
| 10 |
https://arxiv.org/abs/2005.12872
|
| 11 |
|
| 12 |
+
https://arxiv.org/pdf/1801.00868.pdf
|
| 13 |
+
|
| 14 |
Additions
|
| 15 |
- add shown labels as strings
|
| 16 |
- show only animal masks (ask an nlp model?)
|
|
|
|
| 21 |
- Im getting core dumped (segmentation fault) when loading hugging face model.. :()
|
| 22 |
https://github.com/huggingface/transformers/issues/16939
|
| 23 |
- cap slider to 95?
|
| 24 |
+
- switch between panoptic and semantic?
|
| 25 |
"""
|
| 26 |
|
| 27 |
from transformers import DetrFeatureExtractor, DetrForSegmentation
|
|
|
|
| 64 |
# color_mask[label_per_pixel==lbl,:] = color
|
| 65 |
|
| 66 |
# Show image + mask
|
| 67 |
+
pred_img = np.array(image.convert('RGB'))*0.25 + color_mask*0.75
|
| 68 |
pred_img = pred_img.astype(np.uint8)
|
| 69 |
|
| 70 |
return pred_img
|
requirements.txt
CHANGED
|
@@ -4,4 +4,5 @@ gradio
|
|
| 4 |
numpy
|
| 5 |
torch
|
| 6 |
torchvision
|
| 7 |
-
timm
|
|
|
|
|
|
| 4 |
numpy
|
| 5 |
torch
|
| 6 |
torchvision
|
| 7 |
+
timm
|
| 8 |
+
seaborn
|