CAFFE windows 配置 测试
1.连接:http://www.cnblogs.com/love6tao/p/5706830.html
2.python与caffe结合,需要重新编译
http://blog.sina.com.cn/s/blog_74f32c400102wjli.html
3.caffe 和python
http://www.cnblogs.com/denny402/tag/caffe/
4,咖啡的安装
http://linusp.github.io/2015/07/21/caffe-base-usage.html
5.遇到的一些bug解决办法
http://blog.csdn.net/nemo2011/article/details/51232533
caffe安装时应该注意电脑有没有gpu,非独显的要设置成非独显模式,如下图,另外还有一个文件需要改成CPU模式# solver mode: CPU or GPU
solver_mode: CPU
33.无gpu配置
http://blog.csdn.net/zb1165048017/article/details/51355143
33.h很有用
http://www.cnblogs.com/codingmengmeng/p/6184393.html
vs python配置链接
https://blog.csdn.net/yiyisunshine/article/details/55194465
caffe测试
1.收集数据,图片转换为为levedb格式,建议还是LMDB格式,速度快
图片格式,及大小要一致,
(imageset.exe是由vs 的cpp文件生成的,下面这行代码在cmd中运行)
convert_imageset.exe --resize_height=320 --resize_width=320 --shuffle --backend="leveldb" C:\Users\user\Desktop\image1000test200\train C:\Users\user\Desktop\image1000test200\train.txt C:\Users\user\Desktop\image1000test200\train_leveldb
两个图片文件,train val 同时还有两个train.txt,val.txt 在一个层级他们四个,写train.txt,val.txt注意路径问题
2.训练模型
lenet_solver.prototxt 配置文件一定要配置好
caffe.exe train --solver=../../../examples/mnist/lenet_solver.prototxt
3.测试单张图片
需要配置python,在cmd中运行下面的命令
python classifymnist3.py --print_results --force_grayscale --center_only --labels_file ../examples/mnist/synset_words.txt ../examples/mnist/4.jpg resultsfile
4.测试图片不要太大,我试过1000像素以上上,电脑直接崩溃,800像素的卡着走不动,报错,最后改成256,测试中
测试单张图片
1)生成synset_words.txt,对应分类的文件
2)将均值文件由pb格式变为npy格式例如 E:\ProgramFiles\Caffe\caffe-master\examples\switchboard\pbtonpy.py
如下命令:
在caffe中,如果使用的是c++接口,均值文件默认为.binaryproto格式,而如果使用的是python接口,均值文件默认的是numpy的.npy格式,在工作中有时需要将两者进行互相转换,
import numpy as npimport caffeimport sys blob = caffe.proto.caffe_pb2.BlobProto() data = open( 'mean.binaryproto' , 'rb' ).read()blob.ParseFromString(data)arr = np.array( caffe.io.blobproto_to_array(blob) ) out = arr[0] np.save( 'mean.npy' , out )
http://blog.csdn.net/may0324/article/details/52316967
3)测试单张图片
可能你需要安装下面的库,pip就行
https://jingyan.baidu.com/article/a3aad71ae9d5afb1fb0096a3.html
python E:\ProgramFiles\Caffe\caffe-master\examples\switchboard\switchboard.py
import numpy as np
import matplotlib.pyplot as plt
import sys,os
# Make sure that caffe is on the python path:
caffe_root = 'F:/caffe/caffe-master/' # this file is expected to be in {caffe_root}/examples
os.chdir(caffe_root)
import caffe
# Set the right path to your model definition file, pretrained model weights,
# and the image you would like to classify.
MODEL_FILE = caffe_root + 'examples/mnist/deploy.prototxt'
PRETRAINED = caffe_root + 'examples/mnist_iter_200.caffemodel'
IMAGE_FILE = caffe_root + 'examples/mnist/Ruijie.24.jpg'
caffe.set_mode_cpu()
net = caffe.Classifier(MODEL_FILE, PRETRAINED,
mean=np.load(caffe_root + 'examples/mnist/mean.npy').mean(1).mean(1),
channel_swap=(2,1,0),
raw_scale=255,
image_dims=(256, 256))
input_image = caffe.io.load_image(IMAGE_FILE)
plt.imshow(input_image)
prediction = net.predict([input_image]) # predict takes any number of images, and formats them for the Caffe net automatically
print 'prediction shape:', prediction[0].shape
plt.plot(prediction[0])
print 'predicted class:', prediction[0].argmax()
# 加载ImageNet标签
labels_file = caffe_root + 'examples/mnist/synset_words.txt'
#if not os.path.exists(labels_file):
#!E:/ProgramFiles/Caffe/caffe-master/data/ilsvrc12/get_ilsvrc_aux.sh
labels = np.loadtxt(labels_file, str, delimiter='\t')
print 'output label:', labels[prediction[0].argmax()]
plt.show()
# sort top five predictions from softmax output
# 将softmax的输出结果按照从大到小排序,并提取前5名
#top_inds = output_prob.argsort()[::-1][:5] # reverse sort and take five largest items
#print 'probabilities and labels:'
#zip(output_prob[top_inds], labels[top_inds])
CAFFE windows 配置 测试相关推荐
- nginx环境配置Windows本地测试,测试打包后的代码
一.nginx环境配置Windows本地测试 Windows版和Linux版下载地址:http://nginx.org/en/download.html 本文只讲Windows系统的 下载后解压到指定 ...
- Ubuntu 14.04+cuda 7.5+caffe安装配置
换了新电脑,整个人喜气洋洋,然后就屁颠屁颠地开始配置caffe的使用环境. 可是!!!配置这个坑爹的caffe环境让我重装系统N次加上重装cudaN次,后来发现有好多都是很琐碎的注意事项,好多人都没有 ...
- caffe windows学习:第一个测试程序
caffe windows编译成功后,就可以开始进行测试了.如果还没有编译成功的,请参考:caffe windows 学习第一步:编译和安装(vs2012+win 64) 一般第一个测试都是建议对手写 ...
- 2015.08.17 Ubuntu 14.04+cuda 7.5+caffe安装配置
2016.06.10 update cuda 7.5 and cudnn v5 2015.10.23更新:修改了一些地方,身边很多人按这个流程安装,完全可以安装 折腾了两个星期的caffe,windo ...
- caffe windows 训练自己的图片数据
caffe训练自己的数据分为四步: 1.图片数据集准备 2.网络训练所需数据格式 lmdb / leveldb 转换 3.图像均值文件计算 4.网络训练 具体过程如下: 一.图片数据集准备 图片数据收 ...
- windows配置nginx实现负载均衡集群
windows配置nginx实现负载均衡集群 2014-08-20 09:44:40 来源:www.abcde.cn 评论:0 点击:617 网上大部分关于nginx负载均衡集群的教程都是li ...
- 怎么在Caffe中配置每一个层的结构
如何在Caffe中配置每一个层的结构 最近刚在电脑上装好Caffe,由于神经网络中有不同的层结构,不同类型的层又有不同的参数,所有就根据Caffe官网的说明文档做了一个简单的总结. 1. Vision ...
- caffe windows 学习第一步:编译和安装(vs2012+win 64)
转载自:http://www.cnblogs.com/denny402/p/5041060.html 没有GPU,没有linux, 只好装caffe的windows版本了. 我的系统是win10(64 ...
- java环境变量设置优化_Mac/windows配置jdk环境变量-seo优化只选拉一八科技
Mac/windows配置jdk环境变量 Mac配置jdk环境变量 直接双击dmg文件,然后单击[下一步]完成安装.请忽略[配置jdk环境变量]直接跳转到[检查jdk是否安装成功]. Windows配 ...
最新文章
- 替换字符串指定位置字符 php,PHP substr_replace 替换字符串指定位置字符
- 工程制图 (组合体的视图与尺寸注法)
- 根据不同时间,展示不同时间文案
- python:软件目录结构规范
- python redis pipeline使用方法_python使用pipeline批量读写redis的方法
- Python3.5-20190501-廖老师的
- 宝塔LNMP使用步骤nginx+php 7.2
- pyquery获取不到网页完整源代码_爬虫神器之PyQuery实用教程(二),50行代码爬取穷游网...
- eclipse中添加插件的方法
- python 获取帮助页_Python-爬取页面内容(涉及urllib、requests、UserAgent、Json等)
- 坚守本心,你公司的OA解决了以下问题吗?
- JavaScript学习笔记 1
- matlab如何制作莫兰散点图,求大神指点绘制空间内散点图的包络面,,,散点程序如下...
- java小项目-房屋出租系统
- [视频]K8软件破解脱壳入门教程
- c语言%.4f,4f,4F法则是什么
- Windows 关闭 简繁体切换Ctrl+Shift+F
- 微信小程序选择图片并转base64
- LTSPICE使用教程:入门指导
- WORD/WPS打印目录或输出输出PDF时,目录显示“错误未定义标签”,且无法正常跳转的解决方法
热门文章
- php渔夫,渔夫有爱——5.2钓鱼新增内容 附日常稀有鱼经验
- 计算机系高考激励的句子,最新暖心激励高考生的励志句子40句
- 掌财社:专业选手年均开销10万元 执行公司曾9次中标马拉松
- Hive常用函数介绍(窗口函数)
- ardupilot GPS ublox协议学习
- 基于html5+Java+MySQL的健身俱乐部网站设计与实现 文档+任务书+开题报告+答辩PPt+项目源码及数据库文件
- IDEA开启远程dubug模式
- 【SAP】为什么2023年后ABAP仍有广阔前景「来听听ChatGPT怎么说」
- cloudflare免费证书_使用百度云加速免费加速你的博客
- iPhone游戏开发