yolov5+deepsort自定义标注标签问题

关于yolov5+deepsort自定义标注标签问题

在detect.py中找到保存标签代码段

# draw boxes for visualization
                if len(outputs) > 0:
                    bbox_xyxy = outputs[:, :4]
                    identities = outputs[:, -1]
                    draw_boxes(im0, bbox_xyxy, identities)
                    # to MOT format
                    tlwh_bboxs = xyxy_to_tlwh(bbox_xyxy)

                    # Write MOT compliant results to file
                    if save_txt:
                        for j, (tlwh_bbox, output) in enumerate(zip(tlwh_bboxs, outputs)):
                            bbox_top = tlwh_bbox[0]
                            bbox_left = tlwh_bbox[1]
                            bbox_w = tlwh_bbox[2]
                            bbox_h = tlwh_bbox[3]
                            identity = output[-1]
                            with open(txt_path, 'a') as f:
                                f.write(('%g ' * 10 + '\n') % (frame_idx, identity, bbox_top,
                                                            bbox_left, bbox_w, bbox_h, -1, -1, -1, -1))  # label format

main中运行代码

    # 保存跟踪结果
    parser.add_argument('--save-txt', action='store_true', help='save MOT compliant results to *.txt', default=True)

运行结果是一个单独的txt标签文件,第一个参数是帧

img

我想实现的是按帧生成,放在一个目录下
划分为*_1.txt,

img


*_2.txt

img