前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CelebA Datasets——Readme

CelebA Datasets——Readme

作者头像
Tom2Code
发布2023-02-14 11:26:06
9220
发布2023-02-14 11:26:06
举报
文章被收录于专栏:Tom

今天介绍一个在GAN中经常用的人脸数据集:

CelebFaces Attributes (CelebA) Dataset

来自于kaggle上的数据集介绍:

A popular component of computer vision and deep learning revolves around identifying faces for various applications from logging into your phone with your face or searching through surveillance images for a particular suspect. This dataset is great for training and testing models for face detection, particularly for recognising facial attributes such as finding people with brown hair, are smiling, or wearing glasses. Images cover large pose variations, background clutter, diverse people, supported by a large quantity of images and rich annotations. This data was originally collected by researchers at MMLAB, The Chinese University of Hong Kong (specific reference in Acknowledgment section).

代码语言:javascript
复制
Overall
  202,599 number of face images of various celebrities
  10,177 unique identities, but names of identities are not given
  40 binary attribute annotations per image
  5 landmark locations

下载下来的数据集是这样的:

这是数据集:

下面使用代码加载数据集,并且读取25张人脸

代码语言:javascript
复制
# load and plot faces
from os import listdir
from numpy import asarray
from PIL import Image
from matplotlib import pyplot

# load an image as an rgb numpy array
def load_image(filename):
  # load image from file
  image = Image.open(filename)
  # convert to RGB, if needed
  image = image.convert('RGB')
  # convert to array
  pixels = asarray(image)
  return pixels

# load images and extract faces for all images in a directory
def load_faces(directory, n_faces):
  faces = list()
  # enumerate files
  for filename in listdir(directory):
    # load the image
    pixels = load_image(directory + filename)
    # store
    faces.append(pixels)
    # stop once we have enough
    if len(faces) >= n_faces:
      break
  return asarray(faces)

# plot a list of loaded faces
def plot_faces(faces, n):
  for i in range(n * n):
    # define subplot
    pyplot.subplot(n, n, 1 + i)
    # turn off axis
    pyplot.axis('off')
    # plot raw pixel data
    pyplot.imshow(faces[i])
  pyplot.show()

# directory that contains all images
directory = r'your path'
# load and extract all faces
faces = load_faces(directory, 25)
print('Loaded: ', faces.shape)
# plot faces
plot_faces(faces, 5)

下面是celebA数据集官网的同意协议:

代码语言:javascript
复制
Agreement
  The CelebA dataset is available for non-commercial research purposes only.
  All images of the CelebA dataset are obtained from the Internet which are not property of MMLAB, The Chinese University of Hong Kong. The MMLAB is not responsible for the content nor the meaning of these images.
  You agree not to reproduce, duplicate, copy, sell, trade, resell or exploit for any commercial purposes, any portion of the images and any portion of derived data.
  You agree not to further copy, publish or distribute any portion of the CelebA dataset. Except, for internal use at a single site within the same organization it is allowed to make copies of the dataset.
  The MMLAB reserves the right to terminate your access to the CelebA dataset at any time.
  The face identities are released upon request for research purposes only. Please contact us for details.
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-11-30,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Tom的小院 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • CelebFaces Attributes (CelebA) Dataset
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档