Spaces:
Runtime error
Runtime error
Commit
·
77ef39e
1
Parent(s):
f8c5956
activate cuda
Browse files- detector/utils.py +2 -6
detector/utils.py
CHANGED
@@ -12,14 +12,10 @@ 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'))
|
16 |
-
|
17 |
-
model_plates.to(device).eval()
|
18 |
|
19 |
model_chars = torch.hub.load('ultralytics/yolov5', 'custom',
|
20 |
-
path=os.path.join(BASE_DIR, 'detector', 'static', 'chars.pt'))
|
21 |
-
|
22 |
-
model_chars.to(device).eval()
|
23 |
|
24 |
|
25 |
def pad_img_to_fit_bbox(img, x1, x2, y1, y2):
|
|
|
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=device)
|
|
|
|
|
16 |
|
17 |
model_chars = torch.hub.load('ultralytics/yolov5', 'custom',
|
18 |
+
path=os.path.join(BASE_DIR, 'detector', 'static', 'chars.pt'), device=device)
|
|
|
|
|
19 |
|
20 |
|
21 |
def pad_img_to_fit_bbox(img, x1, x2, y1, y2):
|