实验日志
来源:互联网 发布:股票期权 知乎 编辑:程序博客网 时间:2024/04/28 18:13
2017年月17日
实验1
训练网络:LFRfromS_solver_gender.prototxt
实验2
实验说明:
将CelebA和Adience的第0折训练集合并成一个训练集,然后将Adience的第0折测试集作为验证集。
在训练过程中观察准确率。
训练网络:LFRfromS_solver_gender.prototxt
验证集上,最好的准确率出现在第20000代,accuracy = 0.871656
实验3 原始网络
说明:
Age and Gender Classification using Convolutional Neural Networks论文的原网络。
实验4 原始网络
说明:
Age and Gender Classification using Convolutional Neural Networks论文的原网络。
实验5 原始网络
说明:
Age and Gender Classification using Convolutional Neural Networks论文的原网络。
总结
2017年5月3日
抽取VGG16的pool5
的特征,使用libsvm做分类
抽取特征:extract_vgg_feature.py
# coding=utf-8import numpy as np import sysimport osimport structimport scipy.io as sio caffe_root = '/home/zwx/caffe/'sys.path.insert(0, caffe_root + 'python')import caffe# deployPrototxt = ''# modelFile = ''# meanFile = '' # 也可以自己生产# 需要提取的图像列表# imageListFile = ''# imageBasePath = ''gpuIndex = 2# 初始化函数的相关操作def initialize(deployPrototxt, modelFile): print 'initializing ...' caffe.set_mode_gpu() caffe.set_device(gpuIndex) net = caffe.Net(deployPrototxt, modelFile, caffe.TEST) return net# 提取特征并保存为相应的文件def extractFeature(imageBasePath, imageList, net, fea_mat, nd): # 对输入数据做出相应的调整 transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape}) #设定图片的shape格式(1,3,224,224) transformer.set_transpose('data', (2, 0, 1)) #改变维度的顺序,由原始图片(28,28,3)变为(3,224,224) # transformer.set_mean('data', np.load(mean_file).mean(1).mean(1)) # 减去均值,前面训练模型时如果没有减去均值,这儿就不用 transformer.set_raw_scale('data', 255) # 缩放到[0,255]之间 transformer.set_channel_swap('data', (2, 1, 0)) # 交换通道,将图片由RGB变为GBR # 设置batchsize,如果图片较多就设置合适的batchsize batchsize = 1 net.blobs['data'].reshape(batchsize, 3, 224, 224) mean_value = np.array([104, 117, 123], dtype=np.float32) mean_value = mean_value.reshape([3, 1, 1]) num = 0 fea = np.ndarray(shape=(len(imageList),nd,1,1)) for imagefile in imageList: imagefile_abs = os.path.join(imageBasePath, imagefile) print imagefile_abs im = caffe.io.load_image(imagefile_abs) # 加载图片 net.blobs['data'].data[...] = transformer.preprocess('data', im) - mean_value# 执行上面的图片预处理操作,并将图片载入到blob中 out = net.forward() # 执行测试 tmp = net.blobs['pool5'].data fea[num,:,:,:] = tmp num += 1 sio.savemat(fea_mat, {'pool5fea':fea})# 读取文件列表def readImageList(imageListFile): imageList = [] with open(imageListFile, 'r') as fi: while(True): line = fi.readline().strip('\n') if not line: break imageList.append(line) print 'read imageList done image num ', len(imageList) return imageListif __name__ == '__main__': trainImageBasePath = '/home/zwx/database/VGG/images_train/' testImageBasePath = '/home/zwx/database/VGG/images_test/' deployPrototxt25 = '/home/zwx/workspace/VGG_classifier/ThiNet/0.25/deploy.prototxt' deployPrototxt5 = '/home/zwx/workspace/VGG_classifier/ThiNet/0.5/deploy.prototxt' modelFile25 = '/home/zwx/workspace/VGG_classifier/ThiNet/0.25/_iter_120000.caffemodel' modelFile5 = '/home/zwx/workspace/VGG_classifier/ThiNet/0.5/ThiNet-GAP.caffemodel' trainImageList = '/home/zwx/workspace/VGG_classifier/image_train.txt' testImageList = '/home/zwx/workspace/VGG_classifier/image_test.txt' trainImageList = readImageList(trainImageList) testImageList = readImageList(testImageList) # vgg 2.5 net = initialize(deployPrototxt25, modelFile25) extractFeature(trainImageBasePath, trainImageList, net, './trainImagePool5Feature25.mat', 256) extractFeature(testImageBasePath, testImageList, net, './testImagePool5Feature25.mat', 256) # vgg 5 net = initialize(deployPrototxt5, modelFile5) extractFeature(trainImageBasePath, trainImageList, net, './trainImagePool5Feature5.mat', 512) extractFeature(testImageBasePath, testImageList, net, './testImagePool5Feature5.mat', 512)
实验一
% vgg 0.25train_fea=load('trainImagePool5Feature25');test_fea=load('testImagePool5Feature25');model = svmtrain(labels_train,train_fea.pool5fea);[predict_label, accuracy, dec_values] = svmpredict(labels_test, test_fea.pool5fea, model); % test the training data
结果:
实验二
% vgg 0.5train_fea=load('trainImagePool5Feature5');test_fea=load('testImagePool5Feature5');model = svmtrain(labels_train, train_fea.pool5fea);[predict_label, accuracy, dec_values] = svmpredict(labels_test, test_fea.pool5fea, model); % test the training data
0 0
- 实验日志
- DHCP实验日志
- oracle 日志恢复实验
- 日志处理实验
- openfalcon - 日志报警实验
- 转储日志文件实验
- Linux系统日志配置实验
- REDO日志的删除添加实验
- 日志处理实验之MapReduce方法
- 日志文件损坏恢复(实验)
- slf4j-api-1.7.5日志打印实验
- 日志处理实验之MapReduce方法
- hive演示实验--sogou日志数据
- 闪回日志 自动删除 实验记录
- java学习日志(二)---实验1
- java学习日志(三)---实验2
- 实验楼楼赛19之备份日志文件
- 实验说明Oracle重做日志与归档日志的作用
- JavaScript 相关知识
- 在Windows下使用TinyXML-2读取UTF-8编码包含中文字符的XML文件
- 多维度条件情况处理
- [BZOJ 2442][Usaco2011 Open]修剪草坪:单调队列
- $.each循环
- 实验日志
- spring data jpa 的delete方法
- floyd——洛谷P1119 灾后重建
- 隐藏域处理数据技巧
- UVa 725 Division
- shrio cas 集成,多登录页面的配置,session过期校验的定制
- 因子分析理论介绍
- Git简介及基础
- shrio cas集成之请求流程及拦截特性