Spaces:
Runtime error
Runtime error
JunchuanYu
commited on
Commit
·
39d0cbe
1
Parent(s):
d7c2a2b
Update app.py
Browse files
app.py
CHANGED
@@ -14,19 +14,24 @@ from PIL import Image
|
|
14 |
|
15 |
from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_registry
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
#
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# suppress server-side GUI windows
|
25 |
matplotlib.pyplot.switch_backend('Agg')
|
26 |
|
27 |
# setup models
|
28 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
29 |
-
sam = sam_model_registry["vit_b"](checkpoint="./
|
30 |
sam.to(device=device)
|
31 |
mask_generator = SamAutomaticMaskGenerator(sam)
|
32 |
predictor = SamPredictor(sam)
|
|
|
14 |
|
15 |
from segment_anything import SamAutomaticMaskGenerator, SamPredictor, sam_model_registry
|
16 |
|
17 |
+
st.markdown(
|
18 |
+
"""
|
19 |
+
# Segment Anything Model (SAM)
|
20 |
+
### A test on remote sensing data
|
21 |
+
|
22 |
+
- Paper:[Link](https://scontent-fml2-1.xx.fbcdn.net/v/t39.2365-6/10000000_900554171201033_1602411987825904100_n.pdf?_nc_cat=100&ccb=1-7&_nc_sid=3c67a6&_nc_ohc=Ald4OYhL6hgAX-ZcGmS&_nc_ht=scontent-fml2-1.xx&oh=00_AfDk4FvyiDYeXgflANA2CbdV6HSS8CcJmrvjSfTqsgUmog&oe=643500E7)
|
23 |
+
- Github:[https://github.com/facebookresearch/segment-anything](https://github.com/facebookresearch/segment-anything)
|
24 |
+
- Dataset:https://ai.facebook.com/datasets/segment-anything-downloads/(https://ai.facebook.com/datasets/segment-anything-downloads/)
|
25 |
+
- Official Demo:[https://segment-anything.com/demo](https://segment-anything.com/demo)
|
26 |
+
"""
|
27 |
+
)
|
28 |
|
29 |
# suppress server-side GUI windows
|
30 |
matplotlib.pyplot.switch_backend('Agg')
|
31 |
|
32 |
# setup models
|
33 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
34 |
+
sam = sam_model_registry["vit_b"](checkpoint="./meta-model.pth")
|
35 |
sam.to(device=device)
|
36 |
mask_generator = SamAutomaticMaskGenerator(sam)
|
37 |
predictor = SamPredictor(sam)
|