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& ...
随机推荐
- 修车(bzoj 1070)
Description 同一时刻有N位车主带着他们的爱车来到了汽车维修中心.维修中心共有M位技术人员,不同的技术人员对不同的车进行维修所用的时间是不同的.现在需要安排这M位技术人员所维修的车及顺序,使 ...
- Linux脚本中调用SQL,RMAN脚本
Linux/Unix shell脚本中调用或执行SQL,RMAN 等为自动化作业以及多次反复执行提供了极大的便利,因此通过Linux/Unix shell来完成Oracle的相关工作,也是DBA必不可 ...
- NOI2001食物链
描述 动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形.A吃B,B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种. 有人 ...
- 通过Java实现斗地主
功能:洗牌,发牌,对玩家手中的牌排序,看牌 package demo06; import java.util.ArrayList; import java.util.Collections; impo ...
- function in Postgres
CREATE or REPLACE FUNCTION fn_attr_category() RETURNS void AS $BODY$ declare v_tmp_rec record; begin ...
- Light oj 1125 - Divisible Group Sums (dp)
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1125 题意: 给你n个数,q次询问,每次询问问你取其中m个数是d的整数倍的方案 ...
- 使用charles远程调试iOS移动应用
做iOS移动应用很多开发者会喜欢抓网络发包.回包来联调服务端借口以及定位其他网络问 题.如果在Windows系统可以使用fiddler来做iOS的远程代理,只要fiddler所在系统与iOS设备同时连 ...
- 多源最短路径Floyd算法
多源最短路径是求图中任意两点间的最短路,采用动态规划算法,也称为Floyd算法.将顶点编号为0,1,2...n-1首先定义dis[i][j][k]为顶点 i 到 j 的最短路径,且这条路径只经过最大编 ...
- SilverLight-Access:银光项目测试数据类列表
ylbtech-SilverLight-Access:银光项目测试数据类列表 1.A, Product.cs 产品类 1.A, Product.cs 产品类返回顶部 1,/Access/Product ...
- sublimetext3打造pythonIDE
虽然pycharm是非常好用的pythonIDE,用来开发项目很方便,但是修改调整单个或几个小程序就显得很笨重,这时候我们可以选择使用sublime. 一般来说要开发项目我都用pycharm,开发简单 ...