-
大小: 70.58MB文件类型: .zip金币: 2下载: 2 次发布日期: 2023-01-15
- 语言: Python
- 标签:
资源简介
TensorFlow实现的人脸性别/年龄识别
代码片段和文件信息
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed 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.
# ==============================================================================
“““Converts MNIST data to TFRecords file format with Example protos.“““
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import sys
from datetime import datetime
from scipy.io import loadmat
import tensorflow as tf
from imutils.face_utils import FaceAligner
from imutils.face_utils import rect_to_bb
import argparse
import imutils
import dlib
import cv2
import pandas as pd
import numpy as np
import skimage.io as io
from tqdm import tqdm
from sklearn.model_selection import train_test_split
FLAGS = None
def _int64_feature(value):
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def _bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def convert_to(data_set name):
“““Converts a dataset to tfrecords.“““
file_name = data_set.file_name
genders = data_set.gender
ages = data_set.age
face_score = data_set.score
second_face_score = data_set.second_score
num_examples = data_set.shape[0]
base_dir = “data/imdb_crop“
# initialize dlib‘s face detector (HOG-based) and then create
# the facial landmark predictor and the face aligner
shape_predictor = ‘shape_predictor_68_face_landmarks.dat‘
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(shape_predictor)
fa = FaceAligner(predictor desiredFaceWidth=64)
error=0
total=0
# if images.shape[0] != num_examples:
# raise ValueError(‘Images size %d does not match label size %d.‘ %
# (images.shape[0] num_examples))
# rows = images.shape[1]
# cols = images.shape[2]
# depth = images.shape[3]
filename = os.path.join(name + ‘.tfrecords‘)
print(‘Writing‘ filename)
with tf.python_io.TFRecordWriter(filename) as writer:
for index in tqdm(range(num_examples)):
if face_score[index] < 0.75:
continue
# if (~np.isnan(second_face_score[index])) and second_face_score[index] > 0.0:
# continue
if ~(0 <= ages[index] <= 100):
continue
if np.isnan(genders[index]):
continue
try:
# image_raw = io.imread(o
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-06 12:15 Age-Gender-Estimate-TF-master\
文件 1063 2018-03-06 12:15 Age-Gender-Estimate-TF-master\LICENSE
文件 5920 2018-03-06 12:15 Age-Gender-Estimate-TF-master\README.md
文件 6930 2018-03-06 12:15 Age-Gender-Estimate-TF-master\convert_to_records.py
文件 10643 2018-03-06 12:15 Age-Gender-Estimate-TF-master\convert_to_records_multiCPU.py
文件 4926 2018-03-06 12:15 Age-Gender-Estimate-TF-master\demo.py
目录 0 2018-03-06 12:15 Age-Gender-Estimate-TF-master\demo\
文件 1119763 2018-03-06 12:15 Age-Gender-Estimate-TF-master\demo\demo.gif
文件 218316 2018-03-06 12:15 Age-Gender-Estimate-TF-master\demo\demo.jpg
文件 58018 2018-03-06 12:15 Age-Gender-Estimate-TF-master\demo\demo1.jpg
文件 29944 2018-03-06 12:15 Age-Gender-Estimate-TF-master\demo\demo2.jpg
文件 4903 2018-03-06 12:15 Age-Gender-Estimate-TF-master\eval.py
文件 12956 2018-03-06 12:15 Age-Gender-Estimate-TF-master\inception_resnet_v1.py
文件 9063 2018-03-06 12:15 Age-Gender-Estimate-TF-master\inception_resnet_v1.pyc
文件 5527 2018-03-06 12:15 Age-Gender-Estimate-TF-master\inspect_checkpoint.py
文件 370329 2018-03-06 12:15 Age-Gender-Estimate-TF-master\libboost_python.so.1.65.1
文件 1316 2018-03-06 12:15 Age-Gender-Estimate-TF-master\model_transfer.py
目录 0 2018-03-06 12:15 Age-Gender-Estimate-TF-master\models\
文件 0 2018-03-06 12:15 Age-Gender-Estimate-TF-master\models\Put pretrained model here
文件 5553 2018-03-06 12:15 Age-Gender-Estimate-TF-master\print_parameter.ipynb
文件 47396 2018-03-06 12:15 Age-Gender-Estimate-TF-master\read_images.ipynb
文件 19029 2018-03-06 12:15 Age-Gender-Estimate-TF-master\resnet_model.py
文件 1658 2018-03-06 12:15 Age-Gender-Estimate-TF-master\saved_model.py
文件 99693937 2018-03-06 12:15 Age-Gender-Estimate-TF-master\shape_predictor_68_face_landmarks.dat
文件 6492 2018-03-06 12:15 Age-Gender-Estimate-TF-master\test.py
文件 7643 2018-03-06 12:15 Age-Gender-Estimate-TF-master\train.py
目录 0 2018-03-06 12:15 Age-Gender-Estimate-TF-master\train_log\
文件 107935 2018-03-06 12:15 Age-Gender-Estimate-TF-master\train_log\train_log.jpg
文件 4638 2018-03-06 12:15 Age-Gender-Estimate-TF-master\utils.py
相关资源
- Python-DeepMoji模型的pyTorch实现
- Python-使用DeepFakes实现YouTube视频自动换
- Python-一系列高品质的动漫人脸数据集
- Python-Insightface人脸检测识别的最小化
- Python-自然场景文本检测PSENet的一个
- Python-在特征金字塔网络FPN的Pytorch实现
- Python-PyTorch实时多人姿态估计项目的实
- Python-用PyTorch10实现FasterRCNN和MaskRCNN比
- Python-心脏核磁共振MRI图像分割
- Python-基于YOLOv3的行人检测
- Python-RLSeq2Seq用于SequencetoSequence模型的
- Python-PyTorch对卷积CRF的参考实现
- Python-高效准确的EAST文本检测器的一个
- Python-pytorch实现的人脸检测和人脸识别
- Python-UNet用于医学图像分割的嵌套UN
- Python-TensorFlow弱监督图像分割
- Python-基于tensorflow实现的用textcnn方法
- Python-Keras实现Inceptionv4InceptionResnetv1和
- Python-pytorch中文手册
- Python-FastSCNN的PyTorch实现快速语义分割
- Python-滑动窗口高分辨率显微镜图像分
- Python-使用MovieLens数据集训练的电影推
- Python-机器学习驱动的Web应用程序防火
- Python-subpixel利用Tensorflow的一个子像素
-
Python-汉字的神经风格转移Neuralst
y - Python-神经网络模型能够从音频演讲中
- Python-深度增强学习算法的PyTorch实现策
- Python-基于深度学习的语音增强使用
- Python-基于知识图谱的红楼梦人物关系
- Python-STGAN用于图像合成的空间变换生
评论
共有 条评论