MCPcopy Create free account
hub / github.com/Vinyzu/recognizer / __init__

Method __init__

recognizer/components/detector.py:43–60  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

41
42class DetectionModels:
43 def __init__(self) -> None:
44 # Preloading: Loading Models takes ~9 seconds
45 set_num_threads(5)
46 self.executor = ThreadPoolExecutor(max_workers=5)
47 self.loading_futures: List[Future[Callable[..., None]]] = []
48
49 try:
50 self.loading_futures.append(self.executor.submit(self._load_yolo_detector))
51 self.loading_futures.append(self.executor.submit(self._load_vit_model))
52 self.loading_futures.append(self.executor.submit(self._load_vit_processor))
53 self.loading_futures.append(self.executor.submit(self._load_seg_model))
54 self.loading_futures.append(self.executor.submit(self._load_seg_processor))
55 except Exception as e:
56 if sys.version_info.minor >= 9:
57 self.executor.shutdown(wait=True, cancel_futures=True)
58 else:
59 self.executor.shutdown(wait=True)
60 raise e
61
62 def _load_yolo_detector(self):
63 from ultralytics import YOLO

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected