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& ...
随机推荐
- 【06】next() 伪函数
串行,第一个完成后,去执行第二个第二个异步任务,使用next()尾函数.首先我么想完成三个任务,task1,task2,task3,如图: 实现方式1: var fs = require(" ...
- POJ 2635 The Embarrassed Cryptographer (千进制,素数筛,同余定理)
The Embarrassed Cryptographer Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 15767 A ...
- Visual Studio 试用版的评估期已经结束【解决方案】
原文发布时间为:2010-01-09 -- 来源于本人的百度文章 [由搬家工具导入] Visual Studio 试用版的评估期已经结束…… 解决。2010年1月9日0:02:50,本人亲自尝试,可行 ...
- SQLServer Split
ALTER FUNCTION dbo.splitl ( @String VARCHAR(MAX), @Delimiter VARCHAR(MAX) ) RETURNS @temptable TABLE ...
- ASP.NET MVC生成静态页面
1.先付上封装好生成静态页的原代码: public class Common { #region 获取模板页的Html代码 /// <summary> /// 获取页面的Html代码 // ...
- 如何证明一个数的数根(digital root)就是它对9的余数?
数根就是不断地求这个数的各位数之和,直到求到个位数为止.所以数根一定和该数模9同余,但是数根又是大于零小于10的,所以数根模9的余数就是它本身,也就是说该数模9之后余数就是数根. 证明: 假设有一个n ...
- HDU 3549 Flow Problem (dinic模版 && isap模版)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3549 题意: 给你一个有向图,问你1到n的最大流. dinic模版 (n*n*m) #include ...
- Linux基础学习3
鸟哥私房菜第十一章 read 用来读取键盘输入的变量,常被用在shell script的交互当中 [root@www ~]# read [-pt] variable 选项不参数: -p :后面可以 ...
- ASIHTTPRequest实现断点续传
http://blog.csdn.net/daiyelang/article/category/1377418 ASIHTTPRequest可以实现断点续传.网上有一些介绍类似使用: [reque ...
- xss---攻击
xss表示Cross Site Scripting(跨站脚本攻击),它与SQL注入攻击类似,SQL注入攻击中以SQL语句作为用户输入,从而达到查询/修改/删除数据的目的,而在xss攻击中,通过插入恶意 ...