From cb0d6637263d4675b9c87cab8765bf55336df105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E5=B0=A7?= Date: Fri, 23 Feb 2024 11:52:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E6=9D=83=E9=87=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 8 ++++---- test.py | 13 +++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index c7a7078..9c0c5c0 100644 --- a/app.py +++ b/app.py @@ -63,7 +63,7 @@ def worker(id,source,region=None,stream=False): else: region = int(region) print("start loading model...",id,source,region) - model = YOLO('./best.pt') + model = YOLO('best.pt') print("start loaded model!!!") balls = {} count = 0 @@ -119,7 +119,7 @@ def worker(id,source,region=None,stream=False): # detections.conf = np.array([]) # detections.xyxy=np.empty((0, 4), dtype=np.float32) # detections = detections[(detections.tracker_id != None)] - + count += 1 names = {} for xyxy,_, confidence, class_id,tracker_id in detections: @@ -160,7 +160,7 @@ def worker(id,source,region=None,stream=False): print("Client disconnected at", time.ctime()) finally:cap.release() - + def workerloop(stop_event,id,source,target=None,region=None): try: gen = worker(id,source,region) @@ -203,7 +203,7 @@ def post_request(url, data): # count += 1 # if count > 10: # break - + if __name__ == '__main__': # cProfile.run('test_function()', 'test_function.profile') # p = pstats.Stats('test_function.profile') diff --git a/test.py b/test.py index f3cc25c..2d1241b 100644 --- a/test.py +++ b/test.py @@ -4,9 +4,18 @@ from ultralytics import YOLO # Configure the tracking parameters and run the tracker # model = YOLO('best.pt') +# source2 = "rtmp://rtmp01open.ys7.com:1935/v3/openlive/BB2712256_1_2?expire=1733477171&id=654735767607717888&t=a28eb41ed3e1700eb603220184b1a1776af461239b8c483f9f554adb0ed36df6&ev=100" +# source2 = parse.urlencode({"source": source_single_url}) # source2 = "rtmp://rtmp03open.ys7.com:1935/v3/openlive/L05874022_1_1?expire=1726487667&id=625419662355599360&t=228dca5d37b6bead201e80cca3fc5fe74140242278e4eb51a99bcce593cae027&ev=100" # source = parse.urlencode({"source": source2}) -# source = "./videos/123.mp4" -# results = model.track(source=source2, conf=0.3, iou=0.5, show=True) +# print(source) +source = "./videos/123.mp4" +# results = model.track(source=source, conf=0.3, iou=0.5, show=True) model = YOLO('best.pt') results = model.track(source="./videos/123.mp4", tracker='botsort.yaml', show=True) +# results = model(source=source2, tracker='botsort.yaml', show=True, stream=True) +for result in results: + boxes = result.boxes + masks = result.masks + keypoints = result.keypoints + probs = result.probs