SphereFace python抽取人脸特征
来源:互联网 发布:科创论坛 知乎 编辑:程序博客网 时间:2024/06/04 19:23
import numpy,cv2import os,caffeimport sklearn.metrics.pairwise as pwimport time,skimageimport matplotlib.pyplot as pltimport numpy as npclass LightCNN(): def __init__(self, end_cnn="eltwise_fc1", model_version="LightenedCNN_B"): self.net = caffe.Net("sphereface_deploy.prototxt","sphereface_model.caffemodel", caffe.TEST) #load net self.end_cnn="fc5" self.model_version = model_version def getFeat(self, imgPath): image = cv2.imread("043.jpg") #opencv is BRG rgbImg = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) #cv2.imshow("rgbImg",rgbImg) #cv2.waitKey(0) rgbImg = cv2.resize(rgbImg,(96,112)); rgbImg = (rgbImg - 127.5)/128; rgbImg = rgbImg.transpose((2,0,1)) ## equal to permute rgbImg = rgbImg[None,:] # add singleton dimension out = self.net.forward([self.end_cnn], data=rgbImg) return out['fc5'] #labels=np.loadtxt('names.txt',str,delimiter='\n') # get the name #print labels[out['prob'].argmax()]cnn = LightCNN()#for r in [i/10.0 for i in range(10)]: #print rimgPath = "ak.png"t1 = time.time()feat = cnn.getFeat(imgPath)for f in feat: for i in f: print i'''feat2 = cnn.getFeat("E://19.jpg")#print (feat)t2 = time.time()#print len(feat),t2 - t1predicts=pw.cosine_similarity(feat, feat2)#t2 = time.time()print predicts,t2 - t1'''
阅读全文
0 0
- SphereFace python抽取人脸特征
- VGGFace python 抽取人脸特征
- 人脸识别-SphereFace
- caffe -- Python特征抽取
- 人脸识别之SphereFace
- 基于PCA的人脸特征抽取
- LightCNN C++接口抽取人脸特征
- caffe python批量抽取图像特征
- caffe python 批量抽取图像特征---续篇
- caffe python批量抽取图像特征
- Caffe 抽取CNN网络特征 Python
- 人脸识别--SphereFace: Deep Hypersphere Embedding for Face Recognition
- 人脸识别“SphereFace: Deep Hypersphere Embedding for Face Recognition”
- 人脸识别之端到端框架(六)--SphereFace
- 特征选择与特征抽取
- 特征抽取与特征选择
- 特征抽取与特征选择
- 特征提升之特征抽取
- 阿里云推出全球首个影像类应用一站式解决方案:智能云相册
- RN TODO代码解析之二
- 1.Dynamic Connectivity(动态连接)
- Java发起GET/POST请求,接收或发送URL中的数据的问题
- canvas 小技巧
- SphereFace python抽取人脸特征
- mac 终端中添加tree命令显示文件目录结构
- 关于C++中STL的一些东西(不定期整理)
- 小学奥数思维训练题(十三)
- 数据的初步认知
- js中的打印
- logback的配置和使用
- window.showmodaldialog的使用
- 【Scikit-Learn 中文文档】处理文本数据