This repository contains scripts to support the training of NNs to detect Oleander plants in drone imagery. The scripts to download images will work with csv file exported from Labelbox. The training notebook is mostly easily used in python notebooks.
Google Colaboratory is recommended when you require a Jupyter notebook environment with a ready-to-use GPU in the Cloud.
Currently scripts provided carry out 3 processes:
- Fetching images from the web
- Cropping the images according to labels
- Saving images in directories intended to prepare them for use in the PyTorch based NN training workflow described in TorchVision Object Detection Finetuning Tutorial
To use these scripts with this pipeline, first execute as described below, after which the tutorial steps may be followed as is.
Python3 and python modules: Numpy, Pillow, OpenCV, Requests There are multiple ways of installing the above, 1 approach is to use Anaconda. If you use this approach the following will work on most operating systems from a terminal:
- Install Anaconda for whichever OS you are using follow their docs
- Create and activate a conda environment and the run the following and the example
$ conda create --name MyNewPythonEnvironment
$ conda activate MyNewPythonEnvironment
$ conda install pillow opencv requests
$ python download_image.py -p ExampleProject -l "Label 1","Label 2" -csv Example.csv -txt Example.txt -s 1
Project name by which the output root directory will be named
Labels of image annotation, sub-directories will be created for each label
CSV file exported from Labelbox which contains data of annotated images
Text file which contains IDs of images selected for downloaded
Maximum number of images to be downloaded
Upload to your Google Drive a zipped folder of the images downloaded
Mount your Google Drive to the notebook
Unzip the folder to load the images on the hosted server
Run the blocks to set up and train the NN
- You may change the number of epochs to train for based on the size of your dataset
The NN Training notebook is based on TorchVision Object Detection Finetuning Tutorial