1 Star 0 Fork 0

BakuyaLiu / ILGnet

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test.py 763 Bytes
一键复制 编辑 原始数据 按行查看 历史
lewo 提交于 2017-11-14 22:01 . repair some questions
#coding=utf-8
import numpy as np
import sys,os
import caffe
net_file='deploy.prototxt'
caffe_model='bvlc_googlenet_iter_175750.caffemodel'
mean_file='AVA1_mean.npy'
#if you have no GPUs,set mode cpu
caffe.set_mode_cpu()
net = caffe.Net(net_file,caffe_model,caffe.TEST)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2,0,1))
transformer.set_mean('data', np.load(mean_file).mean(1).mean(1))
transformer.set_raw_scale('data', 255)
transformer.set_channel_swap('data', (2,1,0))
img = caffe.io.load_image('good01.jpg')
net.blobs['data'].data[...] = transformer.preprocess('data',img)
out = net.forward()
out1 = out["loss1/loss"][0]
print(out1)
print ("the score of the picture is:" + str(out1[1]))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bakuyaliu/ILGnet.git
git@gitee.com:bakuyaliu/ILGnet.git
bakuyaliu
ILGnet
ILGnet
local

搜索帮助

344bd9b3 5694891 D2dac590 5694891