Alessio Grancini commited on
Commit
0e6feb1
·
verified ·
1 Parent(s): 6d9accd

Update image_segmenter.py

Browse files
Files changed (1) hide show
  1. image_segmenter.py +11 -17
image_segmenter.py CHANGED
@@ -7,23 +7,17 @@ import spaces
7
 
8
  class ImageSegmenter:
9
  def __init__(self, model_type="yolov8s-seg") -> None:
10
- self.model_type = model_type
11
- self.device = 'cuda' # ZeroGPU will always use CUDA
12
- self.is_show_bounding_boxes = True
13
- self.is_show_segmentation_boundary = False
14
- self.is_show_segmentation = False
15
- self.confidence_threshold = 0.5
16
- self.cls_clr = {}
17
-
18
- # params
19
- self.bb_thickness = 2
20
- self.bb_clr = (255, 0, 0)
21
-
22
- # variables
23
- self.masks = {}
24
-
25
- # Model will be loaded in predict to work with ZeroGPU
26
- self.model = None
27
 
28
  def get_cls_clr(self, cls_id):
29
  if cls_id in self.cls_clr:
 
7
 
8
  class ImageSegmenter:
9
  def __init__(self, model_type="yolov8s-seg") -> None:
10
+ # Don't initialize CUDA here
11
+ self.model_type = model_type
12
+ self.is_show_bounding_boxes = True
13
+ self.is_show_segmentation_boundary = False
14
+ self.is_show_segmentation = False
15
+ self.confidence_threshold = 0.5
16
+ self.cls_clr = {}
17
+ self.bb_thickness = 2
18
+ self.bb_clr = (255, 0, 0)
19
+ self.masks = {}
20
+ self.model = None # Model will be loaded in predict
 
 
 
 
 
 
21
 
22
  def get_cls_clr(self, cls_id):
23
  if cls_id in self.cls_clr: