IBEM Mathematical Formula Detection Dataset
label为如下格式
# ====================================
# class => {0: embedded, 1: isolated}
# ====================================
# x_rel y_rel width height class
28.75 28.56 42.29 3.08 1
36.07 38.38 27.37 3.08 1
37.32 46.58 25.16 3.08 1
74.64 15.82 4.77 1.07 0
展示矩形框
img = cv2.imread(img_path) img_h, img_w = img.shape[:2] x_rel, y_rel, w, h, cls = map(float, line.split())
# 将相对坐标转换为实际坐标
x1 = int(x_rel * img_w / 100.0)
y1 = int(y_rel * img_h / 100.0)
x2 = int((x_rel + w) * img_w / 100.0)
y2 = int((y_rel + h) * img_h / 100.0)
print(f"x1: {x1}, y1: {y1}, x2: {x2}, y2: {y2}")
# 边界框与标签
color = class_colors.get(0, (0, 255, 0))
cv2.rectangle(img, (x1, y1), (x2, y2), (0,255,0), 2)
pil = Image.fromarray(img)
pil.show()
cv2.imshow('img', img)
cv2.waitKey(0)
2785

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



