From ff85571b470516ec28b7060da479b9434e685d2b Mon Sep 17 00:00:00 2001 From: luanhailiang Date: Tue, 26 Sep 2023 20:07:44 +0800 Subject: [PATCH] config test --- botsort.yaml | 10 +++++----- ez.py | 40 ++++++++++++++++++++++++++++++++++++++++ test.py | 2 +- 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 ez.py diff --git a/botsort.yaml b/botsort.yaml index eba8d6b..922a5c0 100644 --- a/botsort.yaml +++ b/botsort.yaml @@ -2,17 +2,17 @@ # Default YOLO tracker settings for BoT-SORT tracker https://github.com/NirAharon/BoT-SORT tracker_type: botsort # tracker type, ['botsort', 'bytetrack'] -track_high_thresh: 0.5 # threshold for the first association +track_high_thresh: 0.3 # threshold for the first association track_low_thresh: 0.1 # threshold for the second association -new_track_thresh: 0.6 # threshold for init new track if the detection does not match any tracks -track_buffer: 30 # buffer to calculate the time when to remove tracks -match_thresh: 0.3 # threshold for matching tracks +new_track_thresh: 0.5 # threshold for init new track if the detection does not match any tracks +track_buffer: 10 # buffer to calculate the time when to remove tracks +match_thresh: 0.8 # threshold for matching tracks # min_box_area: 10 # threshold for min box areas(for tracker evaluation, not used for now) # mot20: False # for tracker evaluation(not used for now) # BoT-SORT settings gmc_method: sparseOptFlow # method of global motion compensation # ReID model related thresh (not supported yet) -proximity_thresh: 0.2 +proximity_thresh: 0.1 appearance_thresh: 0.25 with_reid: False \ No newline at end of file diff --git a/ez.py b/ez.py new file mode 100644 index 0000000..b5e490e --- /dev/null +++ b/ez.py @@ -0,0 +1,40 @@ +import cv2 +import time + +# 获取 ezopen 协议的 URL +url = "rtmp://rtmp03open.ys7.com:1935/v3/openlive/L05874022_1_1?expire=1726487667&id=625419662355599360&t=228dca5d37b6bead201e80cca3fc5fe74140242278e4eb51a99bcce593cae027&ev=100" + +# 创建 VideoCapture 对象 +cap = cv2.VideoCapture(url) + +cv2.namedWindow("Video", cv2.WINDOW_NORMAL) # Create a named window +cv2.resizeWindow("Video", 640, 384) # Resize this window + +start_time = time.time() +count = 0 + +# 获取视频帧 +while True: + ret, frame = cap.read() + if time.time() - start_time < 1: # 循环运行直到1秒过去 + count += 1 + else: + print(count) + start_time = time.time() + count = 0 + + # print(ret) + if not ret: + print("Error read video stream.") + break + # 显示视频帧 + cv2.imshow("Video", frame) + # print("0000000000000",ret) + # 等待用户按下任意键退出 + key = cv2.waitKey(1) + if key == 27: + break + +# 释放资源 +cap.release() +cv2.destroyAllWindows() diff --git a/test.py b/test.py index 77920ff..d403e08 100644 --- a/test.py +++ b/test.py @@ -2,4 +2,4 @@ from ultralytics import YOLO # Configure the tracking parameters and run the tracker model = YOLO('best.pt') -results = model.track(source="./videos/123.mp4", conf=0.3, iou=0.5, show=True) +results = model.track(source="./videos/123.mp4", tracker='botsort.yaml', show=True)