用于我的yolov3-spp目标检测项目
txt的格式为:
csv的格式为:
## Readme:
## 将该代码包放到与res.txt同目录下
## python3 txt2csv.py
## output: res_out.csv
import csv
import re
class Item:
def __init__(self, type, con, xmax, xmin, ymax, ymin, img):
self.type = type
self.con = con
self.xmax = xmax
self.xmin = xmin
self.ymax = ymax
self.ymin = ymin
self.img = img
# store all the items
objList = []
# store current img id
itemNow = 0
def Formatt():
fn = open('res.txt', 'r')
fn = fn.read()
for i in range(10):
fn = fn.replace(' ', ' ')
fn = fn.replace(' ', ',')
fn = fn.replace(']][', ']]\n[')
fn = fn.replace('[[', '