Safemotion Lib
Loading...
Searching...
No Matches
mmdet_pytorch_runner.py
Go to the documentation of this file.
1from mmdet.apis import init_detector, inference_detector
2
3class MMDetPyTorchRunner(object):
4 """
5 mmdetection의 모델을 동작시키기 위한 클래스
6 args:
7 model_cfg (str): mmdetection의 모델이 정의된 config파일 경로
8 model_checkpoint (str): 모델의 파라미터가 저장된 파일 경로
9 device (str): 모델이 구동될 디바이스
10 """
11 def __init__(self, model_cfg, model_checkpoint, device='cuda'):
12
13 self.model = init_detector(model_cfg, model_checkpoint, device=device)
14
15 def run_detector(self, image):
16 """
17 객체 검출기를 동작시키는 기능
18 args:
19 image (np.ndarray): RGB 이미지
20 """
21
22 result = inference_detector(self.model, image)
23
24 return result
__init__(self, model_cfg, model_checkpoint, device='cuda')