File size: 3,344 Bytes
2c0f9d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---

title: Land Cover Classification
emoji: 🌍
colorFrom: green
colorTo: blue
sdk: docker
app_file: app.py
pinned: false
---


# Land Cover Classification (Hugging Face Space)

A web-based land cover classification system using a pretrained ResNet50 model and the EuroSAT dataset. This Space features a modern Streamlit interface for easy image upload, prediction, and visualization of land type probabilities.

## πŸš€ Demo

[![Open in Spaces](https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-spaces-sm.svg)](https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME)

## Features

- **Deep Learning Model**: Pretrained ResNet50 fine-tuned on EuroSAT satellite imagery.
- **User-Friendly Web App**: Built with Streamlit for interactive image upload and real-time predictions.
- **Class Visualization**: Displays prediction confidence for each land cover class.
- **Modular Code**: Clean separation of model, data processing, and visualization logic.

## How to Use

1. **Upload a satellite image** (PNG, JPG, JPEG, TIFF).
2. **Preview the image** and click "Run Classification".
3. **View the predicted land cover class** and confidence scores.

## Land Cover Classes

| Index | Class Name             |
|-------|------------------------|
| 0     | AnnualCrop             |
| 1     | Forest                 |
| 2     | HerbaceousVegetation   |
| 3     | Highway                |
| 4     | Industrial             |
| 5     | Pasture                |
| 6     | PermanentCrop          |
| 7     | Residential            |
| 8     | River                  |
| 9     | SeaLake                |

## Project Structure

```

.

β”œβ”€β”€ app.py                # Streamlit web app

β”œβ”€β”€ model_handler.py      # Model loading and prediction logic

β”œβ”€β”€ data_processor.py     # Data preprocessing utilities

β”œβ”€β”€ config.py             # Configuration (class names, paths)

β”œβ”€β”€ requirements.txt      # Python dependencies

β”œβ”€β”€ models/               # Model files (see below)

β”œβ”€β”€ assets/               # Static images for the app

β”œβ”€β”€ Dockerfile            # Docker configuration for Hugging Face Spaces

└── README.md             # This file

```

## Model Files

The following files must be present in the `models/` directory:
- `ResNet50_eurosat.h5`
- `model.weights.best.keras`
- `class_indices.npy`

If you fork this Space, upload these files via the Hugging Face web interface if they are too large for git.

## Deploying on Hugging Face Spaces

### Docker Space Deployment

1. **Create a new Space on Hugging Face:**
   - Go to [Hugging Face Spaces](https://huggingface.co/spaces).
   - Click **"Create new Space"**.
   - Choose **SDK: Docker**.

2. **Push your code:**
   - Push your entire project (including the `Dockerfile`) to the Space.
   - If your model files are too large for git, upload them via the Hugging Face web interface after the initial push.

3. **Wait for the build:**
   - Hugging Face will build and run your Docker container.
   - Your Streamlit app will be available at the Space URL.

## License

MIT License. See [LICENSE](LICENSE) for details.

---

*This Space is powered by [Streamlit](https://streamlit.io/) and [Hugging Face Spaces](https://huggingface.co/spaces).*