File size: 1,806 Bytes
43abac3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
import argparse
from torchvision.datasets import EuroSAT
import yaml

def load_config(config_path="config/config.yaml"):
    with open(config_path, "r") as f:
        return yaml.safe_load(f)

def download_eurosat(config):
    eurosat_dir = config["paths"]["eurosat_dir"]
    
    # Check if already downloaded and extracted
    if os.path.exists(os.path.join(eurosat_dir, 'eurosat')) or os.path.exists(os.path.join(eurosat_dir, '2750')):
        print(f"EuroSAT already exists at {eurosat_dir}. Skipping download.")
        return

    print(f"Downloading EuroSAT to {eurosat_dir}...")
    os.makedirs(eurosat_dir, exist_ok=True)
    # EuroSAT dataset from torchvision handles downloading and extracting
    dataset = EuroSAT(root=eurosat_dir, download=True)
    print("EuroSAT download complete!")

def deepglobe_instructions():
    print("-" * 50)
    print("DeepGlobe Dataset Instructions:")
    print("DeepGlobe Land Cover Classification dataset is hosted on Kaggle.")
    print("To download it, please follow these steps:")
    print("1. Ensure you have a Kaggle account and kaggle.json API key configured.")
    print("2. Run the following command in your terminal:")
    print("   kaggle datasets download -d balraj98/deepglobe-land-cover-classification-dataset -p data/DeepGlobe --unzip")
    print("3. Alternatively, download manually from: https://www.kaggle.com/datasets/balraj98/deepglobe-land-cover-classification-dataset")
    print("-" * 50)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Download datasets for EcoPulse")
    parser.add_argument("--config", default="config/config.yaml", help="Path to config file")
    args = parser.parse_args()

    config = load_config(args.config)
    
    download_eurosat(config)
    deepglobe_instructions()