Edit model card

AdaptFormer model fine-tuned on LEVIR-CD

AdaptFormer model fine-tuned on LEVIR-CD at resolution 512x512. It was introduced in the paper AdaptFormer: An Adaptive Hierarchical Semantic Approach for Change Detection on Remote Sensing Images by Pang et al. and first released in this repository.

Model description

AdaptFormer, uniquely designed to adaptively interpret hierarchical semantics. Instead of a one-size-fits-all approach, it strategizes differently across three semantic depths: employing straightforward operations for shallow semantics, assimilating spatial data for medium semantics to emphasize detailed interregional changes, and integrating cascaded depthwise attention for in-depth semantics, focusing on high-level representations

Here is how to use this model to classify an image:

from transformers import AutoImageProcessor, AutoModel
from PIL import Image
import requests

image_processor = AutoImageProcessor.from_pretrained("deepang/adaptformer-LEVIR-CD")
model = AutoModel.from_pretrained("deepang/adaptformer-LEVIR-CD")

image_A = Image.open(requests.get('https://raw.githubusercontent.com/aigzhusmart/AdaptFormer/main/figures/test_2_1_A.png', stream=True).raw)
image_B = Image.open(requests.get('https://raw.githubusercontent.com/aigzhusmart/AdaptFormer/main/figures/test_2_1_B.png', stream=True).raw)
label = Image.open(requests.get('https://raw.githubusercontent.com/aigzhusmart/AdaptFormer/main/figures/test_2_1_label.png', stream=True).raw)


inputs = preprocessor(images=(image_A, image_B), return_tensors="pt")
outputs = adaptfromer_model(**inputs)
logits = outputs.logits # shape (batch_size, num_labels, height, width)
pred = logits.argmax(dim=1)[0]

License

The license for this model can be found here.

BibTeX entry and citation info

@article{huang2024adaptformer,
  title={AdaptFormer: An Adaptive Hierarchical Semantic Approach for Change Detection on Remote Sensing Images},
  author={Huang, Teng and Hong, Yile and Pang, Yan and Liang, Jiaming and Hong, Jie and Huang, Lin and Zhang, Yuan and Jia, Yan and Savi, Patrizia},
  journal={IEEE Transactions on Instrumentation and Measurement},
  year={2024},
  publisher={IEEE}
}
Downloads last month
20
Safetensors
Model size
12.5M params
Tensor type
I64
·
F32
·
Inference API
Inference API (serverless) does not yet support model repos that contain custom code.