CVAT支持矩形、多边形、视频插值的数据标注平台支持团队协作、复杂项目、视频标注等可导出YOLO格式一、平台地址https://app.cvat.ai/必须先登录在进入系统二、创建项目主要用于管理多个共享同一套标签体系的任务三、创建任务与配置任务是实际进行标注工作的单元包含了要标注的具体数据图片或视频以及最终的标注结果。format就用默认的就行其他的格式导出数据有问题下一步通过脚本转成yolo格式的# -*- coding: utf-8 -*- # CVAT转YOLO格式 import xml.etree.ElementTree as ET import os from pathlib import Path # CVAT的xml格式文件路径 XML_FILE ../cvat/annotations.xml # 数据yolo格式的路径 OUTPUT_DIR Path(/Users/wangqingpan/Desktop/baby/labels) # 标签 CLASS_MAP {heater: 0} def convert_to_yolo_seg(): OUTPUT_DIR.mkdir(parentsTrue, exist_okTrue) try: tree ET.parse(XML_FILE) root tree.getroot() except (ET.ParseError, FileNotFoundError) as e: print(f读取 XML 文件失败: {e}) return img_count 0 for img in root.findall(image): w float(img.get(width)) h float(img.get(height)) # 使用 Path 处理文件名兼容性更好 name Path(img.get(name)).stem yolo_lines [] for tag in [polyline, polygon]: for poly in img.findall(tag): label poly.get(label) if label not in CLASS_MAP: continue cls_id CLASS_MAP[label] points_str poly.get(points) if not points_str: continue raw_points points_str.replace(;, ).replace(,, ).split() try: pts [float(p) for p in raw_points] except ValueError: continue if len(pts) 6 or len(pts) % 2 ! 0: continue norm_pts [] for i in range(0, len(pts), 2): nx max(0.0, min(1.0, pts[i] / w)) ny max(0.0, min(1.0, pts[i1] / h)) norm_pts.extend([f{nx:.6f}, f{ny:.6f}]) yolo_lines.append(f{cls_id} { .join(norm_pts)}) if yolo_lines: output_path OUTPUT_DIR / f{name}.txt with open(output_path, w, encodingutf-8) as f: f.write(\n.join(yolo_lines)) img_count 1 print(f转换完成共处理图片: {img_count} 张。) print(f输出目录: {OUTPUT_DIR}) convert_to_yolo_seg()