DurgaDeepak commited on
Commit
8cfece3
·
verified ·
1 Parent(s): 178b1f7

Update models/detection/detector.py

Browse files
Files changed (1) hide show
  1. models/detection/detector.py +6 -6
models/detection/detector.py CHANGED
@@ -28,12 +28,12 @@ class ObjectDetector:
28
  )
29
 
30
  def load_model(self):
31
- if self.model is None:
32
- from ultralytics import YOLO # Deferring import to avoid early CUDA trigger
33
- self.model = YOLO(self.weights_path)
34
- if self.device == "cuda" and torch.cuda.is_available():
35
- self.model.to("cuda")
36
- return self
37
 
38
 
39
  def predict(self, image: Image.Image, conf_threshold=0.25):
 
28
  )
29
 
30
  def load_model(self):
31
+ if self.model is None:
32
+ from ultralytics import YOLO # Deferring import to avoid early CUDA trigger
33
+ self.model = YOLO(self.weights_path)
34
+ if self.device == "cuda" and torch.cuda.is_available():
35
+ self.model.to("cuda")
36
+ return self
37
 
38
 
39
  def predict(self, image: Image.Image, conf_threshold=0.25):