add network image crop pipeline

This commit is contained in:
2025-01-14 13:38:17 +08:00
parent 744fb7b7b2
commit a16235a593
25 changed files with 427 additions and 2 deletions

View File

@ -143,6 +143,7 @@ def yolo_resnet_tracker(
save_dir = '',
is_save_img = True,
is_save_video = True,
is_annotate = True,
tracker_yaml = "./tracking/trackers/cfg/botsort.yaml",
imgsz=(640, 640), # inference size (height, width)
@ -162,6 +163,7 @@ def yolo_resnet_tracker(
dnn=False, # use OpenCV DNN for ONNX inference
vid_stride=1, # video frame-rate stride
data=ROOT / 'data/coco128.yaml', # dataset.yaml path
video_frames = None
):
# source = str(source)
# Load model
@ -260,7 +262,8 @@ def yolo_resnet_tracker(
'''====== Save results (image and video) ======'''
# save_path = str(save_dir / Path(path).name) # 带有后缀名
im0 = annotator.result()
if is_annotate:
im0 = annotator.result()
if is_save_img:
save_path_img = str(save_dir / Path(path).stem)
if dataset.mode == 'image':
@ -268,6 +271,8 @@ def yolo_resnet_tracker(
else:
imgpath = save_path_img + f"_{frameId}.png"
cv2.imwrite(Path(imgpath), im0)
if video_frames is not None:
video_frames.update({frameId: im0})
# if dataset.mode == 'video' and is_save_video: