The build is tested on Python 3.10.2 and is our recommended Python version. We use pyenv to manage our Python versions and Poetry to manage our packages and dependencies.
- For UNIX/macOS, follow these instructions to set up pyenv locally.
- For Windows, we recommend using the officially endorsed pyenv fork.
Once installed, use the following command in commandline to install the supported Python version.
pyenv install 3.10.2
After the Python version has been installed, type pyenv local
and ensure the output is 3.10.2
After installing the pyenv, install poetry using the official instructions.
Once poetry is installed, type the following to activate the virtual environment:
poetry shell
To deactivate the venv and exit this new shell type exit
While in the active venv, use the following command to install the dependencies.
poetry install
To add a new dependency use poetry add <dependency name>
- For more guidance on dependency management refer to poetry's official website.
While in the active venv, use the following command to run the code
poetry run python .\src\launch.py .\data.yml
To install Blender following these instructions. The build is tested on Blender 3.5 and is our recommended version.
To lint the code we use ruff. Use the following command to run Ruff over the project
ruff check .
If Ruff considers an error "fixable" it can be resolved by running the following
ruff check --fix .
While in the active venv, to run the all the unit tests use the following command from the root directory of your checkout
poetry run pytest
To run a single unit test file use
poetry run pytest tests/test_launch.py
A semi-automation tool for conducting pixel-level segmentation annotation. Currently, supports "ground", "crop", and "weed" types.
poetry run python .\src\machine_learning\utilities\interactive_annotator.py
Upon first execution, it will generate a interactive_annotator_config.ini
file besides it and quit.
Open the ini
file, change the "source image folder" and "output image folder" to your desired paths.
The annotator automatically extracts ground pixels, and then you need to manually mark weed pixels out of crop pixels using various tools provided.
Keyboard operations (this guideline also appears in the title of window)
b
: switch to brushe
: switch to eraserr
: switch to rectangle fillg
: switch to rectangle erasex
: clear all annotationspace
: save current annotation and proceed to nextesc/q
: quit
The annotator has a dedicated Tools Window
for change various settings:
Disp Width
: zoom in or out of the imageDisp Mode
: switch between different display modes:0
: overlay mode: ground pixels darken, weed pixels in red1
: original image2
: ground in grey, weed in red3
: high contrast: ground in red, weed in black
Lower/Upper HSV
: adjust the parameters for extracting ground pixelsSmoothing
: 0 means no smoothingBrush Size
: in pixels
The settings and your progress will be memorised when you press space
to save and continue, so that you can enjoy your favourite settings and continue your work upon next run.