feat: initial release of GIS classification project with strategy-based classifiers selector
This commit is contained in:
commit
af365cfe68
14 changed files with 1115 additions and 0 deletions
81
README.md
Normal file
81
README.md
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# GIS Classification
|
||||
|
||||
Python project for land cover classification using GIS data (GeoTIFF + Shapefile).
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
gis-classification/
|
||||
├── main.py # Main script with parameters
|
||||
├── requirements.txt # Dependencies
|
||||
├── data/ # Input data folder
|
||||
├── output/ # Classification results
|
||||
└── src/
|
||||
├── classifier.py # Main classification pipeline
|
||||
├── data/
|
||||
│ └── loader.py # Data loading (GeoTIFF, Shapefile)
|
||||
├── strategies/
|
||||
│ ├── base.py # Strategy interface
|
||||
│ └── classifiers.py # Built-in strategies (RF, SVM, LR)
|
||||
└── utils/
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
1. Place your input files in `data/`:
|
||||
- `landsat.tif` - GeoTIFF from Landsat
|
||||
- `polygons.shp` - Shapefile with class labels
|
||||
|
||||
2. Configure parameters in `main.py`:
|
||||
- Input/output paths
|
||||
- Classification strategy (RandomForest, SVM, LogisticRegression)
|
||||
- Training parameters
|
||||
|
||||
3. Run:
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
|
||||
## Adding Custom Classification Strategy
|
||||
|
||||
Create a new class implementing `ClassificationStrategy`:
|
||||
|
||||
```python
|
||||
from src.strategies import ClassificationStrategy
|
||||
import numpy as np
|
||||
|
||||
class MyCustomStrategy(ClassificationStrategy):
|
||||
def train(self, X: np.ndarray, y: np.ndarray) -> None:
|
||||
# Your training logic
|
||||
pass
|
||||
|
||||
def predict(self, X: np.ndarray) -> np.ndarray:
|
||||
# Your prediction logic
|
||||
pass
|
||||
|
||||
def predict_proba(self, X: np.ndarray) -> np.ndarray:
|
||||
pass
|
||||
|
||||
def get_params(self) -> dict:
|
||||
pass
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "MyCustom"
|
||||
```
|
||||
|
||||
Then use in `main.py`:
|
||||
```python
|
||||
STRATEGY = MyCustomStrategy()
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
- `output/classified.tif` - Classified raster (GeoTIFF)
|
||||
- Console output with accuracy metrics
|
||||
Loading…
Add table
Add a link
Reference in a new issue