1、yolov8语义分割的模型输出信息
以13800*800输入为例,模型最后有两个输出output0和output1:
[1,37,13125]
1 - batch size
37 - the first 5 values “x, y, width, height and probability” of the detected object, next 32 values are the probability for the mask
13125 - the maximum number of possible detected objects(阈值判断,检测框/掩膜计算,非极大值抑制)
[1,32,200,200] array of 32 masks measuring 200 by 200 pixels
1 - batch size
32 - index of the mask
200 - x points
200 - y points
因此,要获得检测到的对象的输出掩码,您需要首先从第一个输出中选择最佳概率并记住对象掩码的索引。
然后根据掩膜索引从第二个输出 [1,mask of index,200,200] 获取对象掩模 200x200 像素,并将 x 点和 y 点插值到输入图像乘以 4(800 / 200 = 4)。
1、 results = model.track(source="F:/A_bubble/bubble.mp4",
show=False,
save=True,
save_dir=save_path,
save_txt=False,
line_width=1,
stream=True,
retina_masks=True)
# 如果要自定义推理结果的保存路径,需要用save_dir参数指定;但是该参数使用前,必须在D:\workspace\ultralytics-main\ultralytics\cfg\default.yaml配置文件中加入对应的参数名:save_dir: # peanut add