Spaces:
Runtime error
Runtime error
Commit
·
ff3c638
1
Parent(s):
77ef39e
activate cuda
Browse files- detector/utils.py +3 -2
detector/utils.py
CHANGED
@@ -9,13 +9,14 @@ import requests
|
|
9 |
BASE_DIR = os.path.abspath(os.getcwd())
|
10 |
|
11 |
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
|
|
12 |
print('Loading models...', device)
|
13 |
|
14 |
model_plates = torch.hub.load('ultralytics/yolov5', 'custom',
|
15 |
-
path=os.path.join(BASE_DIR, 'detector', 'static', 'plates.pt'), device=
|
16 |
|
17 |
model_chars = torch.hub.load('ultralytics/yolov5', 'custom',
|
18 |
-
path=os.path.join(BASE_DIR, 'detector', 'static', 'chars.pt'), device=
|
19 |
|
20 |
|
21 |
def pad_img_to_fit_bbox(img, x1, x2, y1, y2):
|
|
|
9 |
BASE_DIR = os.path.abspath(os.getcwd())
|
10 |
|
11 |
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
12 |
+
cpu = torch.device('cpu')
|
13 |
print('Loading models...', device)
|
14 |
|
15 |
model_plates = torch.hub.load('ultralytics/yolov5', 'custom',
|
16 |
+
path=os.path.join(BASE_DIR, 'detector', 'static', 'plates.pt'), device=cpu)
|
17 |
|
18 |
model_chars = torch.hub.load('ultralytics/yolov5', 'custom',
|
19 |
+
path=os.path.join(BASE_DIR, 'detector', 'static', 'chars.pt'), device=cpu)
|
20 |
|
21 |
|
22 |
def pad_img_to_fit_bbox(img, x1, x2, y1, y2):
|