网上找了一圈YOLO格式的图像分割数据集可视化工具,没找到,自己写一个吧,比较简陋,一次看一张图片。
image = np.array(Image.open("/path/to/your/image"))
plt.imshow(image, cmap="gray")
ratio = np.zeros(2)
ratio[0], ratio[1] = image.shape[1], image.shape[0]
from matplotlib.patches import Polygon
with open("/path/to/your/yolo_segment_label", "r") as f:
fig, ax = plt.subplots();
for line in f.readlines():
xys = [float(x) for x in line.split()[1:]]
np_xys = np.array(xys)
np_xys = np.reshape(np_xys, (-1,2))
# 加区域
points = np_xys * ratio
polygon = Polygon(points, closed=True, fill=True, color='lightblue', alpha=0.2)
ax.add_patch(polygon)
plt.imshow(image, cmap="gray")
3263

被折叠的 条评论
为什么被折叠?



