您当前的位置: 首页 > 
  • 5浏览

    0关注

    417博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

人脸识别0-06:insightFace-半监督系统搭建(1)-人脸检测

江南才尽,年少无知! 发布时间:2019-08-26 20:28:54 ,浏览量:5

以下链接是个人关于insightFace所有见解,如有错误欢迎大家指出,我会第一时间纠正,如有兴趣可以加QQ:17575010159 相互讨论技术。 人脸识别0-00:insightFace目录:https://blog.csdn.net/weixin_43013761/article/details/99646731: 这是本人项目的源码:https://github.com/944284742/1.FaceRecognition 其中script目录下的文件为本人编写,主要用于适应自己的项目,可以查看该目录下的redeme文件。

系统搭建目的

做过深度学习的哥们应该都知道,收集数据的过程是十分复杂的,无论是手工标签,还是通过其他商家购买,都是十分消耗财力和人力的,为了人脸系统有足够的训练数据,所以我打算搭建这套系统,也分享给大家。这里的是半监督学习,也就是说,还是需要一些人力工作,才能维持该系统的正常运转。搭建这套系统之后,只需要包含人脸的图像就可以了,不需要做任何分类,标定,直接丢到该系统中,就能当作训练的数据(需要人进行小量的筛选)。下面我们就开始把。

人脸检测

假设,我们随便收集了一下,或者抓拍了一下包含人脸,也可能没有包含人脸的照片,那么我们首先是要把这些人脸的都截取出来,并且还要进行人脸矫正。编写insightface-master\src\align\align_my.py(在本人的源码中,作者的代码不知道如何就设置人脸矫正,所以自己重新改写了一下)脚本如下:

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from scipy import misc
import sys
import os
import argparse
import tensorflow as tf
import numpy as np
# import facenet
import detect_face
import random
from time import sleep

sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
import face_image
import src.common.face_preprocess as face_preprocess
from skimage import transform as trans
import cv2


def to_rgb(img):
    w, h = img.shape
    ret = np.empty((w, h, 3), dtype=np.uint8)
    ret[:, :, 0] = ret[:, :, 1] = ret[:, :, 2] = img
    return ret


def IOU(Reframe, GTframe):
    x1 = Reframe[0];
    y1 = Reframe[1];
    width1 = Reframe[2] - Reframe[0];
    height1 = Reframe[3] - Reframe[1];

    x2 = GTframe[0]
    y2 = GTframe[1]
    width2 = GTframe[2] - GTframe[0]
    height2 = GTframe[3] - GTframe[1]

    endx = max(x1 + width1, x2 + width2)
    startx = min(x1, x2)
    width = width1 + width2 - (endx - startx)

    endy = max(y1 + height1, y2 + height2)
    starty = min(y1, y2)
    height = height1 + height2 - (endy - starty)

    if width             
关注
打赏
1592542134
查看更多评论
0.0382s