def baseImageRep_tf(imagesFileName):
    imagesFileName = imagesFileName
    personFileNameDir = os.path.join(cwd, imagesFileName)
    personFileName = os.listdir(personFileNameDir)
    #print("%%%%%%",personFileNameDir,personFileName)
    labels = []
    dataSet = []
    count = 0
    for person in personFileName:
        personDir = os.path.join(personFileNameDir, person)
        imagesList = os.listdir(personDir)
        for image in imagesList:
            try:
                imagePath = os.path.join(personDir, image)  # 目标图片的绝对路径
                rep, _ = getReptf(imagePath)
                # rep = rep.tolist()
                dataSet.append(rep)
                label = person  # 每个person的文件夹名称
                labels.append(label)

            except Exception as e:
                count += 1
                print '没提取到:   %s' % image
                # os.remove(imagePath)

    assert len(dataSet) == len(labels)  # 样本数和标签数要相等
    dataSet = np.array(dataSet)
    labels = np.array(labels).reshape(-1, 1)
    baseData = np.hstack((labels, dataSet))
    print '没有提取成功的图片数量:', count
    return baseData
def baseImageRep_tf(imagesFileName):
    imagesFileName = imagesFileName
    personFileNameDir = os.path.join(cwd, imagesFileName)
    personFileName = os.listdir(personFileNameDir)

    labels = []
    dataSet = []
    imagename = []
    count = 0
    for person in personFileName:
        personDir = os.path.join(personFileNameDir, person)
        imagesList = os.listdir(personDir)
        for image in imagesList:
            try:
                imagePath = os.path.join(personDir, image)  # 目标图片的绝对路径
                rep, _ = getReptf(imagePath)
                dataSet.append(rep)
                label = person  # 每个person的文件夹名称
                labels.append(label)
                imagename.append(image)

            except Exception as e:
                count += 1
                print '没提取到:   %s' % image

    assert len(dataSet) == len(
        labels
    ), "raise a error, length of label isn't equal to length of dataset"  # 样本数和标签数要相等
    dataSet = np.array(dataSet)
    labels = np.array(labels).reshape(-1, 1)
    imagename = np.array(imagename).reshape(-1, 1)
    baseData = np.hstack((labels, dataSet))
    baseData = np.hstack((baseData, imagename))

    print '没有提取成功的图片数量:', count
    return baseData