o
    Ni~                     @   sr   d Z ddlmZ ddlmZ ddlmZ ddlZddlm  mZ	 ddl
mZ dZdZdZG d	d
 d
ejjZdS )zVGGFace2 Dataset.    )absolute_import)division)print_functionNa  @InProceedings{Cao18,
author = "Cao, Q. and Shen, L. and Xie, W. and Parkhi, O. M. and Zisserman, A.",
title  = "VGGFace2: A dataset for recognising faces across pose and age",
booktitle = "International Conference on Automatic Face and Gesture Recognition",
year  = "2018"}a  VGGFace2 is a large-scale face recognition dataset. Images are downloaded from Google Image Search and have large variations in pose, age, illumination, ethnicity and profession. VGGFace2 contains images from identities spanning a wide range of different ethnicities, accents, professions and ages. All face images are captured "in the wild", with pose and emotion variations and different lighting and occlusion conditions. Face distribution for different identities is varied, from 87 to 843, with an average of 362 images for each subject.
z)image_classification/vgg_face2_labels.txtc                   @   s8   e Zd ZdZejdZdZdd Z	dd Z
dd	 Zd
S )VggFace2z<VGGFace2 - A large scale image dataset for face recognition.z1.0.0z  manual_dir should contain two files: vggface2_test.tar.gz and
  vggface2_train.tar.gz.
  You need to register on http://zeus.robots.ox.ac.uk/vgg_face2/signup/ in
  order to get the link to download the dataset.
  c              	   C   sJ   t jt}t jj| tt jt j t jj	|dt j
 dddtdS )N)
names_file)imagelabel	file_name)r   r   z&http://zeus.robots.ox.ac.uk/vgg_face2/)builderdescriptionfeaturessupervised_keyshomepagecitation)tfdscoreget_tfds_path_LABELS_FNAMEDatasetInfo_DESCRIPTIONr   FeaturesDictImage
ClassLabelText	_CITATION)selfr    r   f/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/image_classification/vgg_face2.py_info>   s   zVggFace2._infoc                 C   s   t j|jd}t j|jd}tjj|rtjj|s&td	||t
jjt
jjd||idt
jjt
jjd||idgS )zReturns SplitGenerators.zvggface2_train.tar.gzzvggface2_test.tar.gzzqVGGFace2 requires manual download of the data. Please download the train and test set and place them into: {}, {}archive)name
gen_kwargs)ospathjoin
manual_dirtfiogfileexistsAssertionErrorformatr   r   SplitGeneratorSplitTRAINiter_archiveTEST)r   
dl_manager
train_path	test_pathr   r   r   _split_generatorsP   s(   

zVggFace2._split_generatorsc                 c   sj    |D ]/\}}| dd}|dr|tdd }n|tdd }|||dd d}||fV  qdS )zYields examples.\/ztrain/Nztest/   )r	   r   r   )replace
startswithlen)r   r   fnamefobjr	   recordr   r   r   _generate_examplesh   s   
zVggFace2._generate_examplesN)__name__
__module____qualname____doc__r   r   VersionVERSIONMANUAL_DOWNLOAD_INSTRUCTIONSr   r4   r>   r   r   r   r   r   2   s    r   )rB   
__future__r   r   r   r"   tensorflow.compat.v2compatv2r&   tensorflow_datasets.public_api
public_apir   r   r   r   r   GeneratorBasedBuilderr   r   r   r   r   <module>   s   