|
@@ -184,7 +184,7 @@ class PairedImageSaver:
|
|
|
batch_dir: 批次目录
|
|
batch_dir: 批次目录
|
|
|
batch_id: 批次ID
|
|
batch_id: 批次ID
|
|
|
frame: 全景帧
|
|
frame: 全景帧
|
|
|
- persons: 人员列表
|
|
|
|
|
|
|
+ persons: 人员列表(已由调用方过滤,此处不再过滤)
|
|
|
|
|
|
|
|
Returns:
|
|
Returns:
|
|
|
保存路径或 None
|
|
保存路径或 None
|
|
@@ -193,16 +193,9 @@ class PairedImageSaver:
|
|
|
# 复制图像避免修改原图
|
|
# 复制图像避免修改原图
|
|
|
marked_frame = frame.copy()
|
|
marked_frame = frame.copy()
|
|
|
|
|
|
|
|
- # 过滤有效人员(置信度 >= 阈值)
|
|
|
|
|
- person_threshold = 0.8 # 人员检测置信度阈值
|
|
|
|
|
- valid_persons = []
|
|
|
|
|
- for person in persons:
|
|
|
|
|
- conf = person.get('confidence', 0.0)
|
|
|
|
|
- if conf >= person_threshold:
|
|
|
|
|
- valid_persons.append(person)
|
|
|
|
|
-
|
|
|
|
|
- # 绘制每个有效人员的标记(使用连续的序号)
|
|
|
|
|
- for i, person in enumerate(valid_persons):
|
|
|
|
|
|
|
+ # 绘制每个人员的标记(使用连续的序号)
|
|
|
|
|
+ # 注意:persons 已由调用方(coordinator)过滤,置信度均 >= 阈值
|
|
|
|
|
+ for i, person in enumerate(persons):
|
|
|
bbox = person.get('bbox', (0, 0, 0, 0))
|
|
bbox = person.get('bbox', (0, 0, 0, 0))
|
|
|
x1, y1, x2, y2 = bbox
|
|
x1, y1, x2, y2 = bbox
|
|
|
conf = person.get('confidence', 0.0)
|
|
conf = person.get('confidence', 0.0)
|
|
@@ -233,12 +226,12 @@ class PairedImageSaver:
|
|
|
(0, 0, 0), 2
|
|
(0, 0, 0), 2
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- # 保存图片(使用有效人员数量)
|
|
|
|
|
- filename = f"00_panorama_n{len(valid_persons)}.jpg"
|
|
|
|
|
|
|
+ # 保存图片(使用人员数量)
|
|
|
|
|
+ filename = f"00_panorama_n{len(persons)}.jpg"
|
|
|
filepath = batch_dir / filename
|
|
filepath = batch_dir / filename
|
|
|
cv2.imwrite(str(filepath), marked_frame, [cv2.IMWRITE_JPEG_QUALITY, 90])
|
|
cv2.imwrite(str(filepath), marked_frame, [cv2.IMWRITE_JPEG_QUALITY, 90])
|
|
|
|
|
|
|
|
- logger.info(f"[配对保存] 全景图已保存: {filepath},有效人员 {len(valid_persons)}/{len(persons)}")
|
|
|
|
|
|
|
+ logger.info(f"[配对保存] 全景图已保存: {filepath},人员数量 {len(persons)}")
|
|
|
return str(filepath)
|
|
return str(filepath)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|