Project outside of course scope at (BSc) Machine Learning and Data Science education programme. Colab between IGN and DIKU at University of Copenhagen.
.
├── data
│ ├── *.tif
│ ├── ice.dbf
│ ├── ice.prj
│ ├── ice.sbn
│ ├── ice.sbx
│ ├── ice.shp
│ ├── ice.shx
│ ├── ice.xml
│ ├── land.dbf
│ ├── land.prj
│ ├── land.sbn
│ ├── land.sbx
│ ├── land.shp
│ ├── land.shx
│ ├── land.xml
│ ├── island.dbf
│ ├── island.prj
│ ├── island.sbn
│ ├── island.sbx
│ ├── island.shp
│ └── island.shx
│ ├── island.xml
├── src
│ ├── UNet.py
│ ├── preds_analysis.ipynb
| ├── mosaic_creation_testing
| | ├── mosaic_creation_testing.ipynb
| | ├── mosaic_creation_testing.py
├── output
│ ├── figs
│ │ ├── *.png
│ ├── predictions
│ │ ├── imgs.npy
│ │ ├── masks.npy
│ │ ├── pred_masks.npy
│ ├── models
│ │ ├── *.pth
│ ├── logs
│ │ ├── *.json
│ ├── tensors
│ │ ├── 0.pt
│ │ ├── 1.pt
│ │ ├── 2.pt
│ │ ├── 3.pt
| LICENSE
| README.md
| requirements.txt
The code has only been tested on machines with below specifications. The replication-process of the project has not been tested.
- OS: Ubuntu 23.04
- CPU: Intel i9-8950HK
- GPU: NVIDIA Quadro P3200M
- RAM: 32 GB
- Storage: 1 TB SSD
- CUDA: 11.8
- GPU: NVIDIA® RTX™ A6000
- CPU: 8x Unspecified
- RAM: 64 GB
MIT License
The data is located in the data
folder. The data consists of 2 different types of data: Shapefiles (.dbf
, .prj
, .sbn
, .sbx
, .shp
, .shx
, .xml
) and Satellite images (.tif
). The shapefiles are used to create the masks for the satellite images. Windows of the satellite images are extracted and the corresponding masks are created.
- Satellite images (
.tif
) - Masks (Shapefiles:
.dbf
,.prj
,.sbn
,.sbx
,.shp
,.shx
,.xml
)- Island data
- Land data
- Ice data
- Island data
The source code is located in the src
folder. The source code consists of 2 files and 1 folder:
UNet.py
: The UNet model used for the project.preds_analysis.ipynb
: The notebook used for analysing the predictions.mosaic_creation_testing
: The folder containing the code used for making mosaics from non-orth-rectified tiles (.py
and.ipynb
). These mosaics where not used in the project, as the orth-rectified satellite images where used instead.
The output is located in the output
folder. The output consists of 4 different types of data:
- Figures (
.png
) - Predictions (
.npy
)- Images (
.npy
) - Masks (
.npy
) - Predicted masks (
.npy
)
- Images (
- Models (
.pth
) - Logs (
.json
) - Tensors (
.pt
: These are stored to avoid having to recompute them for each run)
- Clone the repository.
- Get hands on the data and place it in the
data
folder. - Run the code.
If you have a CUDA enabled GPU, I recommend using it. I used CUDA 11.8. To install CUDA 11.8 visit the CUDA Toolkit Archive. To install CUDA 11.8 on Ubuntu 20.04 follow the instructions in the CUDA Toolkit Archive.
I recommend using a virtual environment to run the code. I used conda
to create a virtual environment -- more specifically mamba
which is a faster version of conda
. To create a virtual environment using mamba
with the required packages (specified in environment.yml) run the following command:
mamba env -n <env_name> -f environment.yml
To activate the virtual environment run the following command:
conda activate <env_name>
To install the requirements (without conda, NOT recommended) run the following command:
pip install -r requirements.txt
- Open the
UNet.py
file and change theDATA_PATH
variable to the path of thedata
folder. - Run the
UNet.py
file to train the model. - Open the
preds_analysis.ipynb
file and change theDATA_PATH
variable to the path of thedata
folder. - Run the
preds_analysis.ipynb
file to analyse the predictions.
numpy
matplotlib
torch
torchvision
tqdm
scipy
shapely
geopandas
rasterio
segmentation_models_pytorch
json
tifffile
pickle
torchmetrics
pathlib
- Johannes Brøns Christensen, KU-ID: swd122
- Anders Anker Bjørk (KU-page) (provided the target data for the project)
This project is licensed under the MIT License - see the LICENSE file for details.
- Planet (satellite image provider for the project)