'''
train_test_split(trian_data,trian_target,test_size,random_state)各个参数表示的意义:
trian_data表示被划分的样本特征集
trian_target表示划分的样本的标签(索引值)
test_size表示将样本按比例划分,返回的第一个参数值为:train_data*test_size
random_state表示随机种子。当为整数的时候,不管循环多少次X_train与第一次一样的.
他的值不能是小数.当random_state的值改变的时候,返回的值也会改变
'''
'''
X_train = X_train.reshape(X_train.shape[0], 1, self.img_size, self.img_size)表示的意义为
转为X_train.shape[0]行,1个灰度值,self.img_size*self.img_size列
'''
import tensorflow as tf
import numpy as np
import random
from keras.utils import np_utils
from sklearn.model_selection import train_test_split
x,y = np.arange(10).reshape((5,2)),range(5)
'''
其中arange中的括号是表示行、列
'''
print(x)
print(np.shape(x))
for i in range(4):
  x_trian,x_text,y_trian,y_test = train_test_split(x,y,test_size=0.3,random_state=random.randint(0, 100))
  print(x_trian,x_text)
  print("************")
  print(y_trian,y_test)
  print(x_trian.shape[0])#表示有多少行
  print("***************")
  Y_train = np_utils.to_categorical(y_trian, num_classes=5)#实现二分法
  print(Y_train)
  break

现实人脸识别性别之路----弄清楚train_test_split函数的更多相关文章

  1. 实现人脸识别性别之路---opencv

    import cv2from make_imge import get_file_namefrom train_ph import Modelimport os IMAGE_SIZE = 128if ...

  2. 实现人脸识别性别之路---open CV将图片显示出来

    import cv2filename='E:\\tensorflow\\bu.jpg'#图片的地址 # face_cascade=cv2.CascadeClassifier('C:\\anconda3 ...

  3. 实现人脸识别性别之路---网页上的video标签

    <video> 元素支持三种视频格式: MP4, WebM, 和 Ogg.但是,不同的浏览器对视频格式的支持也不一致,因此为了让浏览器都适应,我们使用source属性来对视频文件格式定义 ...

  4. 实现人脸识别性别之路---matplotlib之注释

    一.准备数据 利用np.linspace()函数得到一定范围内的数据集 利用2*x+1的公式求出y 二.创建窗口 三.根据具有规律的数据画图 四.调整坐标轴 1.将原本的坐标轴的上轴和右轴去掉,使用基 ...

  5. 实现人脸识别性别之路---matplotlib

    Np.linspace(start,stop,num,endpoint,dtype)函数 1.参数:范围值,在范围值中取到的数值总数.是否包含范围值.类型 2.返回值:返回一维数据 3.在指定的范围内 ...

  6. 实现人脸识别性别之路---try语句的使用

    Try语句 用法:处理异常信息 存在的形式:try-except X-except T...-except-else-finally(其中X T为错误的类型) 表达意思:try语句是执行正常语句,如果 ...

  7. paper 97:异质人脸识别进展的资讯

    高新波教授团队异质人脸图像识别研究取得新突破,有望大大降低刑侦过程人力耗费并提高办案效率         近日,西安电子科技大学高新波教授带领的研究团队,在异质人脸图像识别研究领域取得重要进展,其对香 ...

  8. 基于安卓高仿how-old.net实现人脸识别估算年龄与性别

    前几段微软推出的大数据人脸识别年龄应用how-old.net在微博火了一把,它可以通过照片快速获得照片上人物的年龄,系统会对瞳孔.眼角.鼻子等27个“面部地标点"展开分析,进而得出你的“颜龄 ...

  9. opencv学习之路(41)、人脸识别

    一.人脸检测并采集个人图像 //take_photo.cpp #include<opencv2/opencv.hpp> using namespace cv; using namespac ...

随机推荐

  1. android中的AlertDialog具体概述

    android的AlertDialog具体解释 AlertDialog的构造方法所有是Protected的.所以不能直接通过new一个AlertDialog来创建出一个AlertDialog. 要创建 ...

  2. nj08---process、console

    概念:所有属性都可以在程序的任何地方访问,即全局变量.在JavaScript中,通常window是全局对象,而Node.js的全局对象是global,所有全局变量都是global对象的属性,如:con ...

  3. pyspark.mllib.feature module

    Feature Extraction Feature Extraction converts vague features in the raw data into concrete numbers ...

  4. window.location.href=*.html访问没反应问题

    window.location.href=*.html访问没反应问题 1.SpringMvc配置中:扫描controller.视图层配置路径是否正确 报doc根路径 <mapper>匹配错 ...

  5. jsp登录会话

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  6. Oracle数据库Helper类

    using System;using System.Collections.Generic;using System.Data;using System.Data.OleDb;using System ...

  7. Java hashCode(), equals()

    转自:http://blog.csdn.net/fenglibing/article/details/8905007冯立彬的博客 以下是关于HashCode的官方文档定义: hashcode方法返回该 ...

  8. Chromium Graphics: Multithreaded Rasterization

    Multithreaded Rasterization @nduca, @enne, @vangelis (and many others) Implementation status: crbug. ...

  9. UNIX 是什么?怎么诞生的?

    要记住, 当一扇门在你面前关闭的时候, 另一扇门就会打开. 肯·汤普森(Ken Thompson) 和丹尼斯·里奇(Dennis Richie)两个人就是这句名言很好的实例.他们俩是20世纪最优秀的信 ...

  10. [国家集训队]拉拉队排练 Manancher_前缀和_快速幂

    Code: #include <cstdio> #include <algorithm> #include <cstring> using namespace st ...