diff --git a/best0.pt b/best0.pt index d19e0c8..e538ab6 100644 Binary files a/best0.pt and b/best0.pt differ diff --git a/config.json b/config.json index 650d072..32dd98b 100644 --- a/config.json +++ b/config.json @@ -1,18 +1,8 @@ { "groups": [ - { - "name": "电脑2", - "serial_port": "COM13", - "serial_baudrate": 9600, - "camera_index": 1, - "camera_width": 1920, - "camera_height": 1080, - "move_velocity": 400, - "active": false - }, { "name": "服务器", - "serial_port": "COM12", + "serial_port": "COM16", "serial_baudrate": 9600, "camera_index": 0, "camera_width": 1920, diff --git a/main.py b/main.py index 2a9c50e..460846a 100644 --- a/main.py +++ b/main.py @@ -62,6 +62,18 @@ rw = (632, 378) v = active_group['move_velocity'] def yolo_shibie(im_PIL, detections, model): + detections = { + 'center': None, + 'next': None, + 'npc1': None, + 'npc2': None, + 'npc3': None, + 'npc4': None, + 'boss': None, + 'daojv': [], + 'gw': [], + 'zhaozi': None + } results = model(im_PIL) # 目标检测 for result in results: for i in range(len(result.boxes.xyxy)): @@ -186,7 +198,7 @@ while True: continue detections = yolo_shibie(im_opencv[1], detections, model) - if shizi.tuwai(im_opencv[0]): # 进图算法 + if shizi.tuwai(im_opencv[0]) or yolo_shibie(im_opencv[1], model0)['npc1'] is not None or yolo_shibie(im_opencv[1], model0)['npc2'] is not None or yolo_shibie(im_opencv[1], model0)['npc3'] is not None or yolo_shibie(im_opencv[1], model0)['npc4'] is not None: # 进图算法 # 进图算法 im_opencv = get_image.get_frame() # [RGB,PIL] if im_opencv is None: print("⚠️ 无法获取图像帧,跳过本次循环") diff --git a/utils/shizi.py b/utils/shizi.py index ac8f3a4..8eb33f8 100644 --- a/utils/shizi.py +++ b/utils/shizi.py @@ -68,7 +68,7 @@ def tuwai(image): img_bytes = img_encoded.tobytes() result = ocr.classification(img_bytes) print(result) - if result == "tap" or result=='tqp' or result=='top': + if result == "tap" or result=='tqp' or result=='top' or result=='tp': return True else: return False