Skip to content

Crop Weed Classification

Dhruv Patel edited this page Jun 19, 2020 · 6 revisions

We have implemented 2 models: UNet and Bonnet on 2 different datasets namely CWFID & Bonn. These models were trained and tested using different loss functions on both datasets. All the versions can be viewed here.

Project Report

For getting deeper insight of the module, access the entire project report here.

Scripts

real-time.py: Provide the path/to/model-weights and input: video_path/camera_src as command line arguments. Use -h option in terminal for help regarding the command-line arguments.

  • For prediction on video. Execute the below command.

    python real-time.py -m /path/to/model-weights -v /path/to/video

  • For prediction on live camera feed.

    python real-time.py -m /path/to/model-weights -v src

    Here,src is the port no. on which camera is connected. By default it is 0 for webcam.

model.py: Contains the model architectures for UNet and Bonnet.

utils.py: Contains various loss functions, utility functions such as loading models, printing and
plotting metrics, custom data generators, etc.

predict.py: Script for predicting images from a particular directory. Takes path/to/model-weights,input_dir and output_dir(for saving predicted images) as command-line arguments. Use -h option for help in the terminal.

  • python predict.py -i /path/to/input_dir -m /path/to/model-weights -r /path/to/output_dir

pre-process.py: Script for preprocessing the dataset.

main.py Script for training the model. You can select the model and dataset on which you want to train in the script itself.

Conda Environment

  • For setting up the environment download the yaml file of the environment from here.

  • Now create conda environment from the yaml file using the following command.

    conda env create -f tf-gpu.yaml

Model Weights

Final Weights of both the models can be accessed here.

Clone this wiki locally