添加状态分类和液面分割
This commit is contained in:
@ -4,8 +4,8 @@ import numpy as np
|
||||
import os
|
||||
|
||||
# ------------------ 配置 ------------------
|
||||
model_path = '../ultralytics_yolo11-main/runs/train/exp4/weights/best.pt'
|
||||
img_folder = '/home/hx/yolo/ultralytics_yolo11-main/dataset1/test'
|
||||
model_path = '/home/hx/yolo/ultralytics_yolo11-main/runs/train/seg/exp3/weights/best.pt'
|
||||
img_folder = '/media/hx/04e879fa-d697-4b02-ac7e-a4148876ebb0/dataset/seg/dataset2/test'
|
||||
output_mask_dir = 'output_masks1'
|
||||
os.makedirs(output_mask_dir, exist_ok=True)
|
||||
|
||||
@ -139,9 +139,9 @@ def process_image(img_path, output_dir):
|
||||
composite_mask = np.maximum(composite_mask, obj_mask)
|
||||
|
||||
# 保存合并掩码
|
||||
mask_save_path = os.path.join(output_dir, f'mask_{name_only}.png')
|
||||
cv2.imwrite(mask_save_path, composite_mask)
|
||||
print(f"✅ 掩码已保存: {mask_save_path}")
|
||||
#mask_save_path = os.path.join(output_dir, f'mask_{name_only}.png')
|
||||
#cv2.imwrite(mask_save_path, composite_mask)
|
||||
#print(f"✅ 掩码已保存: {mask_save_path}")
|
||||
|
||||
if len(rotated_rects) < 2:
|
||||
print(f"⚠️ 检测到的对象少于2个(共{len(rotated_rects)}个): {filename}")
|
||||
|
||||
Reference in New Issue
Block a user