esun-choi commited on
Commit
088dab0
ยท
1 Parent(s): ef95d87

Update seg.py

Browse files
Files changed (1) hide show
  1. seg.py +2 -1
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]]