CoolFace
Modelpublic

RuiTerrty/RemoteSensingChangeDetection-RSCD.HA2F

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
dataset.cpython-39.pyc19 linesDownload Raw Back to __pycache__
1a

2�~0h��@sFddlZddlZddlmZddlZddlZGdd�dejj	j3�Z4dS)�N)�joinc@s.eZdZddd�Zdd�Zdd	�Zd5d�ZdS)
�Dataset�data/�trainNcsft�t��d��|_��fdd�|jD�|_��fdd�|jD�|_��fdd�|jD�|_||_dS)N�Acsg|]}t��d|��qS)r��osp��.0�x��	file_root�mode��:C:\Users\82607\Desktop\code\ChangeViT\.\dataset\dataset.py�6<listcomp>�z$Dataset.__init__.<locals>.<listcomp>csg|]}t��d|��qS)�Brr	rrrr
rcsg|]}t��d|��qS)�labelrr	rrrrr)�os�listdirr�	file_list�7pre_images�post_images�gts�	transform)�selfr
rrrrr�__init__	s8zDataset.__init__cCs9t|j�S)N)�lenr)rrrr�__len__szDataset.__len__c	Csn|j|}|j|}|j|}t�|�}t�|d�}t�|�}tj||fdd�}|jrf|�||�\}}||fS)Nr�)�axis)rrr�cv2�imread�numpy�concatenater)	r�idxZpre_image_name�10label_nameZpost_image_nameZ	pre_imagerZ11post_image�imgrrr�__getitem__s1213141516zDataset.__getitem__cCs&t�|j|�}|jd|jdd�S)Nr�)�height�width)r"r#r�shape)rr&r(rrr�get_img_info%szDataset.get_img_info)rrN)�__name__�17__module__�__qualname__rrr)r.rrrrrs18	r)r"r�os.pathrrr$�torch.utils.data�torch�utils�datarrrrr�<module>s19