Spaces:
Build error
Build error
Update seg.py
Browse files
seg.py
CHANGED
@@ -8,7 +8,8 @@ import cv2
|
|
8 |
# dinov2 ๋ชจ๋ธ์ segmentation ๋ชจ๋ธ๋ก ํ์ฉํ์๊ณ ์ด๋ฅผ train ํ์ฌ์ pretrained weight๋ฅผ weight ํด๋์ ์ ์ฅํ๊ณ ์๋์ ๊ฐ์ด loadํฉ๋๋ค.
|
9 |
|
10 |
def segmentation(img):
|
11 |
-
device=torch.device("cuda")
|
|
|
12 |
net=torch.load("weights/dinov2_model.pth")
|
13 |
|
14 |
mask_values=[[0, 0, 0], [255, 255, 255]]
|
|
|
8 |
# dinov2 ๋ชจ๋ธ์ segmentation ๋ชจ๋ธ๋ก ํ์ฉํ์๊ณ ์ด๋ฅผ train ํ์ฌ์ pretrained weight๋ฅผ weight ํด๋์ ์ ์ฅํ๊ณ ์๋์ ๊ฐ์ด loadํฉ๋๋ค.
|
9 |
|
10 |
def segmentation(img):
|
11 |
+
#device=torch.device("cuda")
|
12 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
13 |
net=torch.load("weights/dinov2_model.pth")
|
14 |
|
15 |
mask_values=[[0, 0, 0], [255, 255, 255]]
|