o
    Me?                     @   s   d Z ddlmZ ddlZddlZddlZddlmZ ddl	m
  mZ ddlmZ g ZdZdZdZd	Zd
ZdZdd Zeddddddd Zeddddddd Zeddddddd ZdS )a,  
Image dataset for segmentation.
The 2012 dataset contains images from 2008-2011 for which additional
segmentations have been prepared. As in previous years the assignment
to training/test sets has been maintained. The total number of images
with segmentation has been increased from 7,062 to 9,993.
    )print_functionN)download)ImagezJhttp://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tarZ 6cd6e144f989b92b3379bac3b3de84fdz/VOCdevkit/VOC2012/ImageSets/Segmentation/{}.txtz#VOCdevkit/VOC2012/JPEGImages/{}.jpgz*VOCdevkit/VOC2012/SegmentationClass/{}.pngZvoc2012c                    s:   t | i   D ]}| |j< q fdd}|S )Nc                  3   s    t }  |  }|D ]A}| }t|}t|} |  } |  }tt	
|}tt	
|}t|}t|}||fV  qd S )N)SET_FILEformatextractfilestrip	DATA_FILE
LABEL_FILEreadr   openioBytesIOnparray)Zset_fileZsetslineZ	data_fileZ
label_filedatalabelZname2memsub_nameZ	tarobject FD:\Projects\ConvertPro\env\Lib\site-packages\paddle/dataset/voc2012.pyreader3   s   




zreader_creator.<locals>.reader)tarfiler   
getmembersname)filenamer   Zeler   r   r   r   reader_creator,   s   
r   z2.0.0zpaddle.vision.datasets.VOC2012   z>Please use new dataset API which supports paddle.io.DataLoader)ZsinceZ	update_tolevelreasonc                   C      t ttttdS )zL
    Create a train dataset reader containing 2913 images in HWC order.
    Ztrainvalr   r   VOC_URL	CACHE_DIRVOC_MD5r   r   r   r   trainE      	r&   c                   C   r!   )zK
    Create a test dataset reader containing 1464 images in HWC order.
    r&   r"   r   r   r   r   testQ   r'   r(   c                   C   r!   )zJ
    Create a val dataset reader containing 1449 images in HWC order.
    valr"   r   r   r   r   r)   ]   r'   r)   )__doc__
__future__r   r   r   numpyr   Zpaddle.dataset.commonr   Zpaddle.utils.deprecatedutils
deprecatedZPILr   __all__r#   r%   r   r	   r
   r$   r   r&   r(   r)   r   r   r   r   <module>   sJ   

