caffe:自己的数据训练模型 Label Image(三)
来源:互联网 发布:视频调色知乎 编辑:程序博客网 时间:2024/05/17 04:20
(3)给数据做标签:trainData:valData = 7:3
随机将数据分开再Label Image:
txt格式,例如:plane/plane_0.jpg2
from __future__ import division
import os import randomimport cv2
#将TrainDataFinal里面的数据分别移到FinalTrain和FinalVal里面
DataPath = "TrainDataFinal/"TrainSavePath = "FinalTrain/"ValSavePath = "FianlVal/"for root, dirs, files, in os.walk(DataPath):N = 0 for name in files:FileFullPath = os.path.join(root, name)folder = root.split('/')[-1]cls = folder[-1]random.shuffle(files)fileNub = len(files)ValNub = fileNub*3/10if N <= ValNub:img = cv2.imread(FileFullPath)ValPath = ValSavePath + folderif not os.path.exists(ValPath):os.mkdir(ValPath)cv2.imwrite(ValPath + '/' + name, img)with open("FinalAnno/val.txt",'a') as f:f.write(folder[:-1] + '/' + name + '\t' + cls + '\n')N += 1else:img = cv2.imread(FileFullPath)TrainPath = TrainSavePath + folderif not os.path.exists(TrainPath):os.mkdir(TrainPath)cv2.imwrite(TrainPath + '/' + name, img)with open("FinalAnno/train.txt",'a') as f:f.write(folder[:-1] + '/' + name + '\t' + cls + '\n')N += 1print N
0 0
- caffe:自己的数据训练模型 Label Image(三)
- caffe:自己的数据训练模型 (四)
- caffe:用自己的图像数据训练模型
- caffe——cifar10模型训练自己的数据
- caffe:自己的数据训练模型 用于视频检索(一)
- Caffe windows 用自己的数据训练模型
- caffe:自己的数据训练模型 pycaffe(五)
- caffe训练自己的数据
- caffe训练自己的数据
- Caffe训练自己的数据
- caffe训练自己的数据
- Caffe训练自己的数据
- caffe 训练自己的数据
- caffe训练自己的数据
- caffe训练自己的模型步骤
- caffe----训练自己的图片caffenet模型
- caffe训练自己的图片分类模型
- Windows Caffe 学习笔记(三)在Caffe上训练和测试自己的数据
- HDU1273 漫步森林
- 排序算法优劣
- HTML_1th_HTML5基础
- 安卓之音乐播放器
- 我的智能小课表
- caffe:自己的数据训练模型 Label Image(三)
- Ransom Note
- 黄油刀注解工具配置
- SSH连接时提示“THE AUTHENTICITY OF HOST XX CAN’T BE ESTABLISHED”
- 44:Implement strStr()
- 网络基本概念
- 17年2月24日Java后台学习记录,Spring Maven更换版本报错,SSM框架整合,Mysql语句整理。
- 203. Remove Linked List Elements
- jQuery分页插件分享