Spaces:
Sleeping
Sleeping
tyrwh
commited on
Commit
·
6ad3ec3
1
Parent(s):
1bdf0ed
adding cuda support, first test commit
Browse files- nemaquant.py +6 -0
nemaquant.py
CHANGED
|
@@ -6,6 +6,7 @@ import numpy as np
|
|
| 6 |
import pandas as pd
|
| 7 |
import cv2
|
| 8 |
import os
|
|
|
|
| 9 |
from pathlib import Path
|
| 10 |
from ultralytics import YOLO
|
| 11 |
from glob import glob
|
|
@@ -142,6 +143,11 @@ def main():
|
|
| 142 |
if args.key:
|
| 143 |
key = parse_key_file(str(args.keypath))
|
| 144 |
model = YOLO(args.weights)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
# create a couple empty lists for holding results, easier than adding to empty Pandas DF
|
| 146 |
tmp_well = []
|
| 147 |
tmp_numeggs = []
|
|
|
|
| 6 |
import pandas as pd
|
| 7 |
import cv2
|
| 8 |
import os
|
| 9 |
+
from torch import cuda
|
| 10 |
from pathlib import Path
|
| 11 |
from ultralytics import YOLO
|
| 12 |
from glob import glob
|
|
|
|
| 143 |
if args.key:
|
| 144 |
key = parse_key_file(str(args.keypath))
|
| 145 |
model = YOLO(args.weights)
|
| 146 |
+
if cuda.is_available():
|
| 147 |
+
device = 'cuda'
|
| 148 |
+
else:
|
| 149 |
+
device = 'cpu'
|
| 150 |
+
model.to(device)
|
| 151 |
# create a couple empty lists for holding results, easier than adding to empty Pandas DF
|
| 152 |
tmp_well = []
|
| 153 |
tmp_numeggs = []
|