以下链接是个人关于insightFace所有见解,如有错误欢迎大家指出,我会第一时间纠正,如有兴趣可以加微信:17575010159 相互讨论技术。 人脸识别0-00:insightFace目录:https://blog.csdn.net/weixin_43013761/article/details/99646731: 这是本人项目的源码:https://github.com/944284742/1.FaceRecognition 其中script目录下的文件为本人编写,主要用于适应自己的项目,可以查看该目录下的redeme文件。
人脸数据清洗在我们对人脸进行分类之后,其中肯定还包含了很多噪音,我们需要再次对数据进行清洗,本人自己编写的清洗代码如下: script\dataset_clean.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import print_function
import os
import sys
curr_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(curr_path, "../python"))
import mxnet as mx
import random
import argparse
import cv2
import time
import shutil
import copy
import traceback
import numpy as np
import sklearn
from mxnet import ndarray as nd
from sklearn.cluster import DBSCAN
try:
import multiprocessing
except ImportError:
multiprocessing = None
class Model():
def __init__(self,image_size, args):
prefix, epoch = args.model.split(',')
sym, arg_params, aux_params = mx.model.load_checkpoint(prefix, int(epoch))
all_layers = sym.get_internals()
self.model = mx.mod.Module(symbol=sym, context=mx.gpu())
self.model.bind(data_shapes=[('data', (1, 3, image_size[0], image_size[1]))])
self.model.set_params(arg_params, aux_params)
def predict(self,img):
img = nd.array(img)
img = nd.transpose(img, axes=(2, 0, 1)).astype('float32')
img = nd.expand_dims(img, axis=0)
#print(img.shape)
db = mx.io.DataBatch(data=(img,))
self.model.forward(db, is_train=False)
net_out = self.model.get_outputs()
embedding = net_out[0].asnumpy()
embedding = sklearn.preprocessing.normalize(embedding)
return embedding
def imgs_detect(args,embeddings):
#print(imgpaths)
#print(embeddings.shape)
#print('-'*50)
if args.detect_mode==1:
"""
emb_mean = np.mean(embeddings, axis=0, keepdims=True)
emb_mean = sklearn.preprocessing.normalize(emb_mean)
sim = np.dot(embeddings, emb_mean.T)
#print(sim.shape)
sim = sim.flatten()
#print(sim.flatten())
x = np.argsort(sim)
for ix in range(len(x)):
_idx = x[ix]
_sim = sim[_idx]
#if ix
关注
打赏
热门博文
- 史上最全slam从零开始-总目录
- (01)ORB-SLAM2源码无死角解析-(00)目录_最新无死角讲解
- 目标检测00-00:mmdetection(Foveabox为例)-目录-史上最新无死角讲解
- 风格迁移1-00:Liquid Warping GAN(Impersonator)-目录-史上最新无死角讲解
- 姿态估计1-00:FSA-Net(头部姿态估算)-目录-史上最新无死角讲解
- 姿态估计0-00:DenseFusion(6D姿态估计)-目录-史上最新无死角讲解
- 3D点云重建0-00:MVSNet(R-MVSNet)-目录-史上最新无死角讲解
- 视觉工作项目-为后来的你,提供一份帮助!
- 行人检测0-00:LFFD-目录-史上最新无死角解读
- 行人重识别0-00:DG-Net(ReID)-目录-史上最新无死角讲解