Downloads · 30 days
0
PriscillaPio/AYANet
AYANet is a machine learning model from PriscillaPio. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as gpl-3.0.
<div align="center" <img src="./images/AYANetdouble.png" width=40% </div
Downloads · 30 days
0
Access
Public
Updated Aug 18, 2026
Repo size
99.7 MB
Likes
0
Public
Click a slice to open those files.
.png52.8 MB · 99%
From the Hugging Face model README
Link to the proceedings Link to the paper <br>
We run the code in an Anaconda virtual environment on Ubuntu 22.04.3 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64).
You can create an Anaconda environment named ayanet from environment.yml.
conda env create -f environment.yml
conda activate ayanet
git clone https://github.com/Ayana-Inria/AYANet.git
cd AYANet
Dataset needs to be structured as follows.
"""
data structure
-dataroot
├─A
├─img1.png
...
├─B
├─img1.png
...
├─label
├─img1.png
...
└─list
├─val.txt
├─test.txt
└─train.txt
# In list/ folder, prepare text files of the splits and list down all filenames of each split
# for example:
list/train.txt
img1.png
img32.png
...
list/test.txt
img2.png
img15.png
...
list/val.txt
img54.png
img100.png
...
"""
A: pre-change images;
B: post-change images;
label: binary labels;
list: contains train.txt, val.txt and test.txt, each file records the image names (XXX.png) in the change detection dataset.
run_CD.shgpu_ids=0
dataset_type=bcd
dataset_root=/home/Dataset/S2Looking/All # The path to the dataset folder
checkpoint_dir=./checkpoints # Name of the folder where you store the weights of the model during the training
tb_dir=./tb_vis
vis_dir=./vis
split='train' # The split you want to train on (adjust according to the file name you put in the 'list' folder of the dataset)
val_split='val'
epoch=300
batch_size=8
optimizer=adamw
encoder_arc=double # 'double': double encoders, 'gaborencoder': Gabor encoder only, 'efficientnet_ayn': EfficientNet only
decoder_arc=ayanet
lr=0.0001
seed=1302
project_name=AYANet_S2Looking_efficientnetonly_mtf2iadesv2_${encoder_arc}_${decoder_arc}_${split}_${val_split}_${optimizer}_e${epoch}_b${batch_size}_lr${lr}_newlrlambda
sh run_CD.sh
checkpoint_dir under project_name set in run_CD.sh. To evaluate using these weights, simply modify the script eval.sh.
checkpoint_dir, project_name, dataset_root correctlycheckpoint='All' if you want to evaluate all set of weights. It will produce a text file report.txt in the same folder where the weights are being stored, stated the evaluation results followed by the name of the checkpoint corresponding to the evaluation. Otherwise, set the checkpoint's name to evaluate using only 1 particular set of weightsvis_dir is where the qualitative results are stored. You can find the original bi-temporal images, the ground truth, the prediction, and the True Positive, False Positive, False Negative, and True Negative indicators, concatenated together. The number of set of the test images saved in one image will depend on the number of batch_size i.e., if you set it to 8, it means that one image in vis_dir will show you 8 set of bi-temporal images with their corresponding ground truth, prediction, etcgpu_ids=0
dataset_type=bcd
dataset_root=/home/Dataset/S2Looking/All # The path to the dataset folder
test_split='test' # The split you want to test on (adjust according to the file name you put in the 'list' folder of the dataset)
checkpoint_dir=./checkpoints # Name of the folder where you store the weights of the model during the training
vis_dir=./vis # Visualization folder
resultdir=./results
checkpoint='All' # Option 'All' will run the evaluation on all weights stored in checkpoint_dir, if you want to evaluate using only 1 checkpoint, specify the name e.g., 'best_ckpt.pt'
project_name='AYANet_S2Looking_gaborencoderonly_mtf2iadesv2_gaborencoderv2_drtanet_train_val_adamw_e300_b8_lr0.0001_newlrlambda' # Specify which model/experiment you want to do the evaluation with
batch_size=8
encoder_arc=double # 'double': double encoders, 'gaborencoder': Gabor encoder only, 'efficientnet_ayn': EfficientNet only
decoder_arc=ayanet
sh eval.sh
Our network was tested on three datasets for remote sensing building change detection.
LEVIR-CD
WHU-CD
S2Looking
We also provide the code to crop each dataset to the size we used for training i.e., 256 x 256.
The code can be found in misc/dataset_tool.py. We divide the cropping method for each dataset into 3 different functions: crop_levir(), crop_s2looking(), crop_whu() because each of them has different folder structure originally. Make sure you have the same original folder structure as indicated in the comment of each function
Change the path to folder containing original dataset and to the folder you want your cropped images to be stored at. Using an absolute path is recommended
# Path to the root folder of original resolution images
ori_folder = r"/mnt/c/Dataset/S2Looking"
# Path to the root folder of cropped images
cropped_folder = r"/mnt/c/Dataset/S2Looking-Cropped"
reproduction/WHU_split/. Simply copy these files to the list folder and unify all the images so the folder will have the structure indicated in Dataset Preparation section above, after running the codeYou can download the weights of AYANet for each dataset, that produced the results published in the paper, from Google Drive link
eval.sh. For example, you put the weights in reproduction/weights/, change the settings like this if you want to reproduce the evaluation for the LEVIR-CD dataset:
(For the technical reason, to run the model with these weights, it is necessary to uncomment one part of models/EfficientNet.py (line 559). This does not change the architecture of AYANet.)gpu_ids=0
dataset_type=bcd
dataset_root=/home/Dataset/LEVIR-Cropped # The path to the dataset folder
test_split='test' # Do the evaluation on the test split
checkpoint_dir=./reproduction
vis_dir=./vis # Visualization folder
resultdir=./results
checkpoint='AYANet_LEVIR_ICPR2024' # Name of the pretrain_weights
project_name='weights'
batch_size=8
encoder_arc=double
decoder_arc=ayanet
sh eval.sh
The code is released under the GPL-3.0-only license. See LICENSE file for more details.
If you use this code for your research, please cite our paper:
@InProceedings{10.1007/978-3-031-78347-0_9,
author="Osa, Priscilla Indira and Zerubia, Josiane and Kato, Zoltan",
editor="Antonacopoulos, Apostolos
and Chaudhuri, Subhasis
and Chellappa, Rama and Liu, Cheng-Lin
and Bhattacharya, Saumik and Pal, Umapada",
title="AYANet: A Gabor Wavelet-Based and CNN-Based Double Encoder for Building Change Detection in Remote Sensing",
booktitle="Pattern Recognition",
year="2025",
publisher="Springer Nature Switzerland",
address="Cham",
pages="131--146",
isbn="978-3-031-78347-0"
}