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g dZd	ZG d
d dejjZdS )z=Remote Sensing Image Scene Classification (RESISC45) Dataset.    )absolute_import)division)print_functionNa  @article{Cheng_2017,
   title={Remote Sensing Image Scene Classification: Benchmark and State of the Art},
   volume={105},
   ISSN={1558-2256},
   url={http://dx.doi.org/10.1109/JPROC.2017.2675998},
   DOI={10.1109/jproc.2017.2675998},
   number={10},
   journal={Proceedings of the IEEE},
   publisher={Institute of Electrical and Electronics Engineers (IEEE)},
   author={Cheng, Gong and Han, Junwei and Lu, Xiaoqiang},
   year={2017},
   month={Oct},
   pages={1865-1883}
}a  RESISC45 dataset is a publicly available benchmark for Remote Sensing Image
Scene Classification (RESISC), created by Northwestern Polytechnical University
(NWPU). This dataset contains 31,500 images, covering 45 scene classes with 700
images in each class.)-airplaneairportbaseball_diamondbasketball_courtbeachbridge	chaparralchurchcircular_farmlandcloudcommercial_areadense_residentialdesertforestfreewaygolf_courseground_track_fieldharborindustrial_areaintersectionislandlakemeadowmedium_residentialmobile_home_parkmountainoverpasspalaceparking_lotrailwayrailway_stationrectangular_farmlandriver
roundaboutrunwaysea_iceshipsnowbergsparse_residentialstadiumstorage_tanktennis_courtterracethermal_power_stationwetlandz:http://www.escience.cn/people/JunweiHan/NWPU-RESISC45.htmlc                   @   s8   e Zd ZdZejdZdZdd Z	dd Z
dd	 Zd
S )Resisc45z@NWPU Remote Sensing Image Scene Classification (RESISC) Dataset.z3.0.0z  Dataset can be downloaded from OneDrive:
  https://1drv.ms/u/s!AmgKYzARBl5ca3HNaHIlzp_IXjs
  After downloading the rar file, please extract it to the manual_dir.
  c              	   C   sF   t jj| tt jt jjg ddt jjtdt j	 ddt
tdS )N)   r3      )shape)namesimagelabelfilename)r8   r9   )builderdescriptionfeaturessupervised_keyshomepagecitation)tfdscoreDatasetInfo_DESCRIPTIONr=   FeaturesDictImage
ClassLabel_LABELSText_URL	_CITATION)self rM   e/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/image_classification/resisc45.py_infoM   s   zResisc45._infoc                 C   sJ   t j|jd}tjj|std	t
|jtjjtjjd|idgS )zReturns SplitGenerators.zNWPU-RESISC45zOYou must download the dataset manually from {}, extract it, and place it in {}.path)name
gen_kwargs)osrP   join
manual_dirtfiogfileexistsAssertionErrorformatrJ   rA   rB   SplitGeneratorSplitTRAIN)rL   
dl_managerrP   rM   rM   rN   _split_generators[   s   zResisc45._split_generatorsc                 c   sX    t jj|D ]!}t jjtj||dD ]}||tj|d}||fV  qqdS )zYields examples.z*.jpgr7   N)	rV   rW   rX   listdirglobrS   rP   rT   basename)rL   rP   r9   r:   examplerM   rM   rN   _generate_examplesi   s   
zResisc45._generate_examplesN)__name__
__module____qualname____doc__rA   rB   VersionVERSIONMANUAL_DOWNLOAD_INSTRUCTIONSrO   r`   re   rM   rM   rM   rN   r2   B   s    r2   )ri   
__future__r   r   r   rS   tensorflow.compat.v2compatv2rV   tensorflow_datasets.public_api
public_apirA   rK   rD   rH   rJ   rB   GeneratorBasedBuilderr2   rM   rM   rM   rN   <module>   s   