TensorFlow通过人脸识别年龄(1)

目的

使用tensorflow训练集通过人脸识别年龄

源代码

参考了博主的源码 http://blog.csdn.net/u014365862/article/details/53869712
训练集地址

import os  
import glob  
import tensorflow as tf
from tensorflow.contrib.layers import *  
from tensorflow.contrib.slim.python.slim.nets.inception_v3 import inception_v3_base  
import numpy as np  
from random import shuffle  

age_table=['(0, 2)','(4, 6)','(8, 12)','(15, 20)','(25, 32)','(38, 43)','(48, 53)','(60, 100)']  
sex_table=['f','m']  # f:女; m:男  

# AGE==True 训练年龄模型,False,训练性别模型  
AGE = True  

if AGE == True:  
    lables_size = len(age_table) # 年龄  
else:  
    lables_size = len(sex_table) # 性别  

face_set_fold = 'AdienceBenchmarkOfUnfilteredFacesForGenderAndAgeClassification'  

fold_0_data = os.path.join(face_set_fold, 'fold_0_data.txt')  
fold_1_data = os.path.join(face_set_fold, 'fold_1_data.txt')  
fold_2_data = os.path.join(face_set_fold, 'fold_2_data.txt')  
fold_3_data = os.path.join(face_set_fold, 'fold_3_data.txt')  
fold_4_data = os.path.join(face_set_fold, 'fold_4_data.txt')  

face_image_set = os.path.join(face_set_fold, 'aligned')  

def parse_data(fold_x_data):  
    data_set = []  

    with open(fold_x_data, 'r') as f:  
        line_one = True  
        for line in f:  
            tmp = []  
            if line_one == True:  
                line_one = False  
                
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值