o
    Ni                     @   sz   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	ZG d
d dejjZdS )9The PlantVillage dataset of healthy and unhealthy leaves.    )absolute_import)division)print_functionNa  
@article{DBLP:journals/corr/HughesS15,
  author    = {David P. Hughes and
               Marcel Salath{'{e}}},
  title     = {An open access repository of images on plant health to enable the
               development of mobile disease diagnostics through machine
               learning and crowdsourcing},
  journal   = {CoRR},
  volume    = {abs/1511.08060},
  year      = {2015},
  url       = {http://arxiv.org/abs/1511.08060},
  archivePrefix = {arXiv},
  eprint    = {1511.08060},
  timestamp = {Mon, 13 Aug 2018 16:48:21 +0200},
  biburl    = {https://dblp.org/rec/bib/journals/corr/HughesS15},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
a)  
The PlantVillage dataset consists of 54303 healthy and unhealthy leaf images
divided into 38 categories by species and disease.

NOTE: The original dataset is not available from the original source
(plantvillage.org), therefore we get the unaugmented dataset from a paper that
used that dataset and republished it. Moreover, we dropped images with
Background_without_leaves label, because these were not present in the original
dataset.

Original paper URL: https://arxiv.org/abs/1511.08060
Dataset URL: https://data.mendeley.com/datasets/tywbtsjrjv/1
zhttps://data.mendeley.com/datasets/tywbtsjrjv/1/files/127d0761-7c63-46f0-b08e-d0d9f7cad9da/Plant_leaf_diseases_dataset_without_augmentation.zip)&Apple___Apple_scabApple___Black_rotApple___Cedar_apple_rustApple___healthyBlueberry___healthyCherry___healthyCherry___Powdery_mildewz*Corn___Cercospora_leaf_spot Gray_leaf_spotCorn___Common_rustCorn___healthyCorn___Northern_Leaf_BlightGrape___Black_rotzGrape___Esca_(Black_Measles)Grape___healthyz*Grape___Leaf_blight_(Isariopsis_Leaf_Spot)z(Orange___Haunglongbing_(Citrus_greening)Peach___Bacterial_spotPeach___healthyzPepper,_bell___Bacterial_spotzPepper,_bell___healthyPotato___Early_blightPotato___healthyPotato___Late_blightRaspberry___healthySoybean___healthySquash___Powdery_mildewStrawberry___healthyStrawberry___Leaf_scorchTomato___Bacterial_spotTomato___Early_blightTomato___healthyTomato___Late_blightTomato___Leaf_MoldTomato___Septoria_leaf_spotz-Tomato___Spider_mites Two-spotted_spider_miteTomato___Target_SpotTomato___Tomato_mosaic_virus&Tomato___Tomato_Yellow_Leaf_Curl_Virusc                   @   s4   e Zd ZdZejdZdd Zdd Z	dd Z
d	S )
PlantVillager   z1.0.0c              
   C   s>   t jj| tt jt j t j t jjt	ddddt
dS )N)namesimagezimage/filenamelabel)r(   r)   z https://arxiv.org/abs/1511.08060)builderdescriptionfeaturessupervised_keyshomepagecitation)tfdscoreDatasetInfo_DESCRIPTIONr,   FeaturesDictImageText
ClassLabel_LABELS	_CITATION)self r;   j/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/image_classification/plant_village.py_infom   s   zPlantVillage._infoc                 C   s$   | t}tjjtjjd|idgS )zReturns SplitGenerators.datapath)name
gen_kwargs)download_and_extract_URLr0   r1   SplitGeneratorSplitTRAIN)r:   
dl_managerpathr;   r;   r<   _split_generators{   s
   
zPlantVillage._split_generatorsc                 c   st    t D ]4}|dddd}tj|d|d}tjj|D ]}tj	|}|||d}d
|||fV  qqd	S )
zYields examples. z[_ ],z[_,]1Plant_leave_diseases_dataset_without_augmentationz*.[jJ][pP][gG]r'   z{}/{}N)r8   replaceosrG   jointfiogfileglobbasenameformat)r:   r>   r)   fuzzy_label	glob_pathfpathfnamerecordr;   r;   r<   _generate_examples   s    zPlantVillage._generate_examplesN)__name__
__module____qualname____doc__r0   r1   VersionVERSIONr=   rH   rZ   r;   r;   r;   r<   r%   h   s    r%   )r^   
__future__r   r   r   rM   tensorflow.compat.v2compatv2rO   tensorflow_datasets.public_api
public_apir0   r9   r3   rB   r8   r1   GeneratorBasedBuilderr%   r;   r;   r;   r<   <module>   s   *