import json
import os
def convert(img_size, box):
# dw = 1. / (img_size[0])
# dh = 1. / (img_size[1])
# x = (box[0] + box[2]) / 2.0 - 1
# y = (box[1] + box[3]) / 2.0 - 1
# w = box[2] - box[
【python代码】解析labelme的json文件转换为yolo标签格式
最新推荐文章于 2024-05-17 21:28:45 发布
import jsonimport osdef convert(img_size, box): # dw = 1. / (img_size[0]) # dh = 1. / (img_size[1]) # x = (box[0] + box[2]) / 2.0 - 1 # y = (box[1] + box[3]) / 2.0 - 1 # w = box[2] - box[0] # h = box[3] - box[1] # x = x * dw
摘要由CSDN通过智能技术生成