-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCProcess.py
41 lines (30 loc) · 1.27 KB
/
SCProcess.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from models.ut_yolo8_head_only import ut_yolo8_head_only
from models.ut_yolo8_tail_only import ut_yolo8_tail_only
from models.mm_yolox_head_only import mm_yolox_head_only
from models.mm_yolox_tail_only import mm_yolox_tail_only
class SCProcess:
def __init__(self, model_name, device='cuda:0'):
if model_name == 'ut_yolo8_head_only':
self.head, self.tail = ut_yolo8_head_only()
elif model_name == 'ut_yolo8_tail_only':
self.head, self.tail = ut_yolo8_tail_only()
elif model_name == 'mm_yolox_head_only':
self.head, self.tail = mm_yolox_head_only(device=device)
elif model_name == 'mm_yolox_tail_only':
self.head, self.tail = mm_yolox_tail_only(device=device)
def initialize(self):
print("Hello from SCProcess")
pass
def process_head(self, data=None):
output = self.head(data)
return output
def process_tail(self, data=None):
output = self.tail(data)
return output
if __name__ == '__main__':
import cv2
model_name = 'ut_yolo8_head_only'
input_img = cv2.imread('models/images/sample.jpg')
sc = SCProcess(model_name=model_name)
output_head = sc.process_head(data=input_img)
output_tail = sc.process_tail(data=output_head)