File size: 512 Bytes
6b14782 ccbb01f c266c7b 6b14782 ccbb01f 6b14782 | 1 2 3 4 5 6 7 8 9 10 11 12 | import torch
from ultralytics import YOLO
class Models:
def __init__(self,device=None):
self.device = 'cpu' if device=='cpu' else device if device else ('cuda' if torch.cuda.is_available() else 'cpu')
self.daModel = YOLO("AI_Models/DA.pt").to(self.device)
self.st_orientation = YOLO("AI_Models/st_orientation.pt").to(self.device)
self.exclusivity_model = YOLO("AI_Models/exclusivity.pt").to(self.device)
if 'cuda' in self.device:
torch.cuda.empty_cache() |