-
Notifications
You must be signed in to change notification settings - Fork 23
Crop Weed Classification
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.
NOTE: Bonn Dataset contains samples with missing images. So, there is a need to remove such samples. We have listed these samples which contains missing images. The list can be accessed from Bonn Dataset Analysis .
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.
-
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
Final Weights of both the models can be accessed here.