IBEM公式检测数据集标注使用方法

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值