-
处理
cars_annos.mat
文件:- 提取去数据集的类型名称
- 提取出序号, 图片名, 类别, 属于测试集还是训练集
import scipy.io # 提取标签 def process1(): data = scipy.io.loadmat('./data/cars_annos.mat') class_names = data['class_names'] f_class = open('label_map.txt1', 'w') num = 1 for j in range(class_names.shape[1]): class_name = str(class_names[0, j][0]).replace(' ', '_') print(num, class_name) f_class.write(str(num) + ' ' + class_name + '\n') num = num + 1 f_class.close() # 提取 序号, 图片名, 类别, 属于测试集还是训练集(0,1表示) def process2(): import scipy.io data = scipy.io.loadmat('./data/cars_annos.mat') annotations = data['annotations'] f_train = open('mat2txt.txt', 'w') num = 1 for i in range(annotations.shape[1]): name = str(annotations[0, i][0])[2:-2] test = int(annotations[0, i][6]) clas = int(annotations[0
处理Stanford cars数据集用于目标检测训练
最新推荐文章于 2024-05-06 14:34:04 发布