--- license: cc-by-nc-4.0 task_categories: - image-segmentation language: - en tags: - Remote Sensing Images - Satellite Images - Grass - Cloud --- # Cloud-Adapter-Datasets This dataset card aims to describe the datasets used in the [KTDA](https://xavierjiezou.github.io/KTDA/), Knowledge Transfer and Domain Adaptation for Fine-Grained Remote Sensing Image Segmentation ## Install ```bash pip install huggingface-hub ``` ## Usage ```bash # Step 1: Download datasets huggingface-cli download --repo-type dataset XavierJiezou/ktda-datasets --local-dir data --include grass.zip huggingface-cli download --repo-type dataset XavierJiezou/ktda-datasets --local-dir data --include cloud.zip # Step 2: Extract datasets unzip grass.zip -d grass unzip cloud.zip -d l8_biome ``` ## Example ```python import os import zipfile from huggingface_hub import hf_hub_download # Define the dataset repository repo_id = "XavierJiezou/ktda-datasets" # Select the zip file of the dataset to download zip_files = [ "grass.zip", # "cloud.zip", ] # Define a directory to extract the datasets output_dir = "cloud_adapter_paper_data" # Ensure the output directory exists os.makedirs(output_dir, exist_ok=True) # Step 1: Download and extract each ZIP file for zip_file in zip_files: print(f"Downloading {zip_file}...") # Download the ZIP file from Hugging Face Hub zip_path = hf_hub_download(repo_id=repo_id, filename=zip_file, repo_type="dataset") # Extract the ZIP file extract_path = os.path.join(output_dir, zip_file.replace(".zip", "")) with zipfile.ZipFile(zip_path, "r") as zip_ref: print(f"Extracting {zip_file} to {extract_path}...") zip_ref.extractall(extract_path) # Step 2: Explore the extracted datasets # Example: Load and display the contents of the "hrc_whu" dataset dataset_path = os.path.join(output_dir, "hrc_whu") train_images_path = os.path.join(dataset_path, "img_dir", "train") train_annotations_path = os.path.join(dataset_path, "ann_dir", "train") # Display some files in the training set print("Training Images:", os.listdir(train_images_path)[:5]) print("Training Annotations:", os.listdir(train_annotations_path)[:5]) # Example: Load and display an image and its annotation from PIL import Image # Load an example image and annotation image_path = os.path.join(train_images_path, os.listdir(train_images_path)[0]) annotation_path = os.path.join(train_annotations_path, os.listdir(train_annotations_path)[0]) # Open and display the image image = Image.open(image_path) annotation = Image.open(annotation_path) print("Displaying the image...") image.show() print("Displaying the annotation...") annotation.show() ``` ## Source Data - l8_biome: https://landsat.usgs.gov/landsat-8-cloud-cover-assessment-validation-data ## Citation ```bib @article{l8_biome, title = {Cloud detection algorithm comparison and validation for operational Landsat data products}, journal = {Remote Sensing of Environment}, volume = {194}, pages = {379-390}, year = {2017}, author = {Steve Foga and Pat L. Scaramuzza and Song Guo and Zhe Zhu and Ronald D. Dilley and Tim Beckmann and Gail L. Schmidt and John L. Dwyer and M. {Joseph Hughes} and Brady Laue} } ``` ## Contact For questions, please contact Xavier Jiezou at xuechaozou (at) foxmail (dot) com.