def predict(image,the_net):
inputs = []
try:
tmp_input = image
tmp_input = cv2.resize(tmp_input,(SIZE,SIZE))
tmp_input = tmp_input[13:13+224,13:13+224];
tmp_input = np.subtract(tmp_input,mean)
tmp_input = tmp_input.transpose((2, 0, 1))
tmp_input = np.require(tmp_input, dtype=np.float32)
except Exception as e:
raise Exception("Image damaged or illegal file format")
return
the_net.blobs['data'].reshape(1, *tmp_input.shape)
the_net.reshape()
the_net.blobs['data'].data[...] = tmp_input
the_net.forward()
scores = the_net.blobs['prob'].data[0]
return copy.deepcopy(scores)
test_afew_face_vgg.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录