智算多多联系我们


关注我们

公众号

视频号
隐私协议用户协议
◎ 2025 北京智算多多科技有限公司版权所有京ICP备 2025150592号-1
多边形标注不是简单的描边游戏,专业标注员会采用分层标注策略:
原始图像通常需要标准化处理才能高效标注。以下脚本可批量调整图像尺寸并保持长宽比:
import cv2
import os
def resize_images(input_dir, output_dir, max_size=1024):
os.makedirs(output_dir, exist_ok=True)
for img_name in os.listdir(input_dir):
img_path = os.path.join(input_dir, img_name)
img = cv2.imread(img_path)
h, w = img.shape[:2]
scale = min(max_size / h, max_size / w)
new_h, new_w = int(h * scale), int(w * scale)
resized = cv2.resize(img, (new_w, new_h))
cv2.imwrite(os.path.join(output_dir, img_name), resized)
建议在标注前统一图像命名格式(如0001.jpg),避免特殊字符导致解析错误
以下为标注质量检查脚本:
import json
import numpy as np
def check_annotation(json_path):
with open(json_path) as f:
data = json.load(f)
issues = []
for shape in data['shapes']:
points = np.array(shape['points'])
# 检查节点数量
if len(points) < 3:
issues.append("Polygon has less than 3 points")
return issues