caffe-ubuntu1604-gtx850m-i7-4710hq----VGG_ILSVRC_16_layers.caffemodel
c++调用vgg16:
./build/install/bin/classification \
/media/whale/wsWin10/wsCaffe/model-zoo/VGG16//deploy.prototxt \
/media/whale/wsWin10/wsCaffe/model-zoo/VGG16/VGG_ILSVRC_16_layers.caffemodel \
data/ilsvrc12/imagenet_mean.binaryproto \
/media/whale/wsWin10/wsCaffe/model-zoo/VGG16/synset_words.txt \
/media/whale/wsWin10/images/person/2.jpg
然后就报错了。
然后
whale@sea:/media/whale/wsWin10/wsUbuntu16./DlFrames/caffe$ ./build/install/bin/classification /media/whale/wsWin10/wsCaffe/model-zoo/VGG16//deploy.prototxt /media/whale/wsWin10/wsCaffe/model-zoo/VGG16/VGG_ILSVRC_16_layers.caffemodel data/ilsvrc12/imagenet_mean.binaryproto ./3labels.txt /media/whale/wsWin10/images/person/2.jpg
labels_.size() = output_layer->channels() = ---------- Prediction for /media/whale/wsWin10/images/person/.jpg ----------
0.3333 - ""
0.3333 - ""
0.3333 - ""
whale@sea:/media/whale/wsWin10/wsUbuntu16./DlFrames/caffe$ ./build/install/bin/classification /media/whale/wsWin10/wsCaffe/model-zoo/VGG16//deploy.prototxt /media/whale/wsWin10/wsCaffe/model-zoo/VGG16/VGG_ILSVRC_16_layers.caffemodel data/ilsvrc12/imagenet_mean.binaryproto ./3labels.txt /media/whale/wsWin10/images/person/3.jpg
labels_.size() = output_layer->channels() = ---------- Prediction for /media/whale/wsWin10/images/person/.jpg ----------
0.3333 - ""
0.3333 - ""
0.3333 - ""
只能给3个标签,不然就报错。然后,。。。,这个模型是假的吗?
还是什么是假的?
keras-python调用vgg16:
python-keras接口调用模型要简单些,只需要标签文件,和keras模型就可以了。
from keras.applications.vgg16 import VGG16
from keras.preprocessing import image
from keras.applications.vgg16 import preprocess_input
from keras.models import Model
import numpy as np
import matplotlib.pyplot as plt
# get_ipython().magic(u'matplotlib inline') # ### 显示图像 # In[2]: img_path = './data/elephant.jpg'
img_path = '/media/whale/wsWin10/images/dog/0c02094a98d126cf541c4318188699a5.jpg'
img_path = '/media/whale/wsWin10/images/dog/dd92db98b99479db3619f62c724757a4.jpg' img = image.load_img(img_path, target_size=(224, 224)) plt.imshow(img)
plt.show( ) # ### 加载VGG16模型(包含全连接层) # In[3]: model = VGG16(include_top=True, weights='imagenet')
print(" type(model) = ", type(model)) # In[4]: x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) print( "x.max() = ", x.max()) scores = model.predict(x) # In[10]: class_table = open('./data/synset_words', 'r')
lines = class_table.readlines()
print(" scores type: ", type(scores))
print(" scores shape: ", scores.shape)
print(" np.argmax(scores) = ", np.argmax(scores))
print('result is ', lines[np.argmax(scores)])
class_table.close() import sys
sys.exit()

。。。/wsWin10/wsPycharm/sklearnStu/Keras-Tutorials/08.vgg-16.py
Using TensorFlow backend.
2018-01-16 17:35:28.541700: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-01-16 17:35:28.627059: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:892] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-01-16 17:35:28.627317: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Found device 0 with properties:
name: GeForce GTX 850M major: 5 minor: 0 memoryClockRate(GHz): 0.9015
pciBusID: 0000:01:00.0
totalMemory: 3.95GiB freeMemory: 3.63GiB
2018-01-16 17:35:28.627334: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 850M, pci bus id: 0000:01:00.0, compute capability: 5.0)
(' type(model) = ', <class 'keras.engine.training.Model'>)
('x.max() = ', 151.061)
(' scores type: ', <type 'numpy.ndarray'>)
(' scores shape: ', (1, 1000))
(' np.argmax(scores) = ', 235)
('result is ', 'n02106662 German shepherd, German shepherd dog, German police dog, alsatian\n') Process finished with exit code 0
翻译下: 德国牧羊犬,德国牧羊犬,德国警犬,阿尔萨斯
caffe-ubuntu1604-gtx850m-i7-4710hq----VGG_ILSVRC_16_layers.caffemodel的更多相关文章
- 迁移学习︱艺术风格转化:Artistic style-transfer+ubuntu14.0+caffe(only CPU)
说起来这门技术大多是秀的成分高于实际,但是呢,其也可以作为图像增强的工具,看到一些比赛拿他作训练集扩充,还是一个比较好的思路.如何在caffe上面实现简单的风格转化呢? 好像网上的博文都没有说清楚,而 ...
- caffe 利用VGG训练自己的数据
写这个是因为有童鞋在跑VGG的时候遇到各种问题,供参考一下. 网络结构 以VGG16为例,自己跑的细胞数据 solver.prototxt: net: "/media/dl/source/E ...
- Windows caffe 跑mnist实例
一. 装完caffe当然要来跑跑自带的demo,在examples文件夹下. 先来试试用于手写数字识别的mnist,在 examples/mnist/ 下有需要的代码文件,但是没有图像库. mn ...
- caffe训练模型中断的解决办法(利用solverstate)
caffe训练过程中会生成.caffemodel和.solverstate文件,其中caffemodel为模型训练文件,可用于参数解析,solverstate为中间状态文件 当训练过程由于断电等因素中 ...
- 安装Caffe时出现的错误
一.error MSB3073类错误 一般是由于CommonSettings.props配置出现错误. 第一处是你安装CUDA的版本号,第二次是你安装cudnn的路径. 也可参照http://blog ...
- TensorFlow模型转为caffe模型
最近由于要将训练好的模型移植到硬件上,因此需要将TensorFlow转为caffe模型. caffe模型需要两个文件,一个是定义网络结构的prototxt,一个是存储了参数的caffemodel文件. ...
- finetune on caffe
官方例程:http://caffe.berkeleyvision.org/gathered/examples/finetune_flickr_style.html 相应的中文说明:http://blo ...
- 使用Caffe完成图像目标检测 和 caffe 全卷积网络
一.[用Python学习Caffe]2. 使用Caffe完成图像目标检测 标签: pythoncaffe深度学习目标检测ssd 2017-06-22 22:08 207人阅读 评论(0) 收藏 举报 ...
- Caffe源码-Net类(下)
net.cpp部分源码 // 接着上一篇博客的介绍,此部分为Net类中前向反向计算函数,以及一些与HDF5文件或proto文件相互转换的函数. template <typename Dtype& ...
随机推荐
- pat 团体天梯赛 L2-012. 关于堆的判断
L2-012. 关于堆的判断 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 将一系列给定数字顺序插入一个初始为空的小顶堆H[] ...
- delphi 内存泄露 分析
- ef core 使用include进行外键连接查询
在entity framework core中,如果两个实体涉及到外键连接,查询的时候默认是只查自身而不会去查询外键表的.如果想要让查询结果包含外键实体,则需要使用include方法来让查询结果包含外 ...
- shell的各种运行模式?
交互式shell和非交互式shell,login shell和non-login shell.首先,这是两个不同的维度来划分的,一个是是否交互式,另一个是是否登录.. 交互式模式就是shell等待你的 ...
- (11)centos之vim使用
ZZ 保存并退出 :x 保存并退出 :q 不保存退出
- 几个相似的DP题
HDU1398 题意:把一个整数分拆成1.4.9.16.…….256.289(注意:只到289)这17个完全平方数的和,有几种方法. 解法不用说自然是DP,因为搜索显然超时. (这样的题我一般不敢开i ...
- noip2013/day1/1/转圈游戏
总时间限制: 10000ms 单个测试点时间限制: 1000ms 内存限制: 128000kB 描述 n 个小伙伴(编号从 0 到 n-1)围坐一圈玩游戏.按照顺时针方向给 n 个位置编号,从 ...
- 安全搜索引擎Shodan(搜蛋)命令行模式使用TIPS
https://www.shodan.io/ 与谷歌通过网址来搜索互联网的方式不同,Shodan通过互联网背后的通道来搜索信息.它就象是一种“黑暗”的谷歌,不断在寻找服务器.网络摄像头.打印机.路由器 ...
- js 拦截全局 ajax 请求
你是否有过下面的需求:需要给所有ajax请求添加统一签名.需要统计某个接口被请求的次数.需要限制http请求的方法必须为get或post.需要分析别人网络协议等等,那么如何做?想想,如果能够拦截所有a ...
- 【hash】什么是hash,什么是哈希,什么是hash散列,什么是hash一致性算法【关于hash的详解】
什么是hash,什么是哈希,什么是hash散列,什么是hash一致性算法