Skip to content

Code repository for the paper "Unsupervised Semantic Label Generation​ in Agricultural Fields"

License

Notifications You must be signed in to change notification settings

PRBonn/unsemlabag

Repository files navigation

Unsupervised Semantic Label Generation in Agricultural Fields


Paper   •   Contact Us

Setup

Build docker image:

make build

You may need to install the NVIDIA container toolkit to bring the GPUs to work with Docker.

Data Samples and Weights

We provide one small rgb map in samples/maps to test our label generation.

Inside of samples/network we provide three folders train, val and test, they all contain the same single image from PhenoBench with its semantic label. This allows to check the training procedure and to test the provided weights on one sample. To perform a full training-validation, one can download the PhenoBench dataset from https://www.phenobench.org/.

Option 1: Manual download

Download the data samples here: samples.zip,

and the weights here: weights.ckpt.

Unzip the samples and copy the folder samples and the weights into the main folder.

Option 2: Automated download

Execute

make download

Test on samples

We provide some samples to try the generation of the labels and the evaluation of our trained model. You can test the label generation running

make generate

You can see the sample map in /samples/maps and the generated label image will be saved in results. To visualize the results of the trained model, you can run

make test

The images used for the inference are in samples/network/test/images and one image displaying input = network rpediction - ucnertainty - corrected prediction will be saved in results.

How to generate a dataset from the map

You can generate images from the complete map using

make map_to_images

only after you generated the labels, otherwise it will fail. The resulting images will be saved in results/generated.

How to train the network

You can train the network running

make train

By default this will use the samples in samples/network, where there are three defined folders train, val, test. If you want to use the generated samples you need to modify the config/config.yaml file, specifically

##Data
data:
    name: 'map' # either "pb" or "map" 
    ...
    root_dir: "./results/generated"

which specify the dataloader to use, i.e., MapData, and the root directory for the data, i.e., samples/generated.

How make the code your own

Data

If you want to train on data that is not inside of the folder, you need to

  1. In the makefile change the DATA_PATH to point at your data
  2. Write or import the dataloader: a. Implement the dataloader in the datasets folder b. change the init.py file in the datasets folder to import the dataloader c. Change your config file data name and root_dir to access your new data

Style Guidelines

In general, we follow the Python PEP 8 style guidelines. Please install black to format your python code properly. To run the black code formatter, use the following command:

black -l 120 path/to/python/module/or/package/

To optimize and clean up your imports, feel free to have a look at this solution for PyCharm.

About

Code repository for the paper "Unsupervised Semantic Label Generation​ in Agricultural Fields"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published