Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions examples/anthropogenic-activities/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Example: segmentation of the border points based on the analog cadastral plans
# Example: detection of anthropic soils potentially suitable for rehabilitation

A working setup is provided here to test the multi-class classification and the use of empty tiles, as well as false positive ones.
It consists of the following elements:
Expand All @@ -7,10 +7,10 @@ It consists of the following elements:
* input data
* scripts for data preparation and the first step of post-processing

The full project is available is its [own repository](https://github.com/swiss-territorial-data-lab/proj-borderpoints).
The full project is available is its [own repository](https://github.com/swiss-territorial-data-lab/proj-sda).


The **installation** can be carried out by following the instructions in the main readme file. When using Docker, the container must be launched from the repository root folder before running the workflow:
The **installation** can be carried out by following the instructions [here](../../README.md). When using Docker, the container must be launched from this repository root folder before running the workflow:

```bash
$ sudo chown -R 65534:65534 examples
Expand All @@ -28,39 +28,53 @@ $ sudo chmod -R a+w examples

## Data

"[SWISSIMAGE Journey through time](https://www.swisstopo.admin.ch/en/timetravel-aerial-images)" is an annual dataset of aerial images of Switzerland from 1946 to today. These images are downloaded from the geo.admin.ch server using the XYZ connector.

The following datasets are available for this example in the `data` folder:

* images: SWISSIMAGE Journey is an annual dataset of aerial images of Switzerland from 1946 to today. The images are downloaded from the geo.admin.ch server using XYZ connector.
* empty tiles: tiles without any object of interest added to the training dataset to provide more contextual tiles.
* FP labels: objects frequently present among false positives, used to include the corresponding tiles in the training.
* ground truth: labels vectorised by the domain experts.
Disclaimer: the ground truth dataset is unofficial and has been produced specifically for the purposes of the project.
* Empty tiles: tiles without any object of interest can be added to the training dataset to provide more context.
* False positive (FP) labels: objects frequently present among false positives, used to include the corresponding tiles in the training.
* Ground truth: labels vectorised by domain experts.

> [!CAUTION]
> The ground truth dataset is unofficial and has been produced specifically for the purposes of the project.


## Workflow

The workflow can be executed by running the following list of actions and commands.

Prepare the data:
```
$ python scripts/prepare_data.py config_trne.yaml

```bash
$ python prepare_data.py config_trne.yaml
$ stdl-objdet generate_tilesets config_trne.yaml
```

Train the model:
```

```bash
$ stdl-objdet train_model config_trne.yaml
$ tensorboard --logdir output/trne/logs
```

Open the following link with a web browser: `http://localhost:6006` and identify the iteration minimising the validation loss and select the model accordingly (`model_*.pth`) in `config_trne`. The path to the trained model is `output/trne/logs/model_<number of iterations>.pth`, currently `model_0002499.pth` is used. <br>
Open another shell and launch TensorBoard:

Perform and assess detections:
```bash
$ docker compose run --rm -p 6006:6006 stdl-objdet tensorboard --logdir /app/examples/anthropogenic-activities/output/trne/logs --bind_all
```

Open the following link with a web browser: `http://localhost:6006` and identify the iteration minimising the validation loss and select the model accordingly (`model_*.pth`) in `config_trne`. The path to the trained model is `output/trne/logs/model_<number of iterations>.pth`, currently `model_0002499.pth` is used.

Perform and assess detections:

```bash
$ stdl-objdet make_detections config_trne.yaml
$ stdl-objdet assess_detections config_trne.yaml
```

The detections obtained by tiles can be merged when adjacent:
```
$ python scripts/merge_detections.py config/config_trne.yaml

```bash
$ python merge_detections.py config_trne.yaml
```