Plant Counting-Density Estimation-Quickly implement high-throughput plant counting from high-resolution RGB images

TasselNetv2+

This repository contains the official implementation of TasselNetv2+ for plant counting, see the paper for details:

TasselNetv2+: A Fast Implementation for High-Throughput Plant Counting from High-Resolution RGB Imagery

"Frontiers of Plant Science", 2020

Hao Lu and Cao Zhiguo

Highlights

  • Efficient: TasselNetv2+ runs an order of magnitude faster than TasselNetv2 , about 30fps on a single GTX 1070 at 1980×1080 image resolution;
  • Effective: It is retrained to the same level of counting accuracy compared to its TasselNetv2 counterpart;
  • Easy to use: Pretrained plant counting models are included in this repository.

Insert image description here

Install

Code has been tested on Python 3.7.4 and PyTorch 1.2.0. Please follow the official instructions to configure your environment. See requirements.txtother required packages in .

Prepare data

Wheat ear counting

  1. Download the Wheat Ear Count (WEC) dataset from Google Drive (2.5 GB) . I have reorganized the data and the ownership of the dataset belongs to this repository .
  2. Unzip the dataset and move it to ./dataa folder, the path structure should look like this:
$./data/wheat_ears_counting_dataset
├──── train
│    ├──── images
│    └──── labels
├──── val
│    ├──── images
│    └──── labels

Corn tassel counting

  1. Download the Maize Tassel Count (MTC) dataset from Google Drive (1.8 GB) .
  2. Unzip the dataset and move it to ./dataa folder, the path structure should look like this:
$./data/maize_counting_dataset
├──── trainval
│    ├──── images
│    └──── labels
├──── test
│    ├──── images
│    └──── labels

Sorghum ear counting

  1. Download the Sorghum Head Count (SHC) dataset from Google Drive (152 MB) . Attribution of this dataset belongs to this repository . I only used the two subsets with dotted annotations.
  2. Unzip the dataset and move it to ./dataa folder, the path structure should look like this:
$./data/sorghum_head_counting_dataset
├──── original
│    ├──── dataset1
│    └──── dataset2
├──── labeled
│    ├──── dataset1
│    └──── dataset2

infer

Run the following command to reproduce our results on TasselNetv2+ on the WEC/MTC/SHC dataset:

sh config/hl_wec_eval.sh

sh config/hl_mtc_eval.sh

sh config/hl_shc_eval.sh
  • The results are saved in the path ./results/$dataset/$exp/$epoch.
epoch: 470, mae: 5.50, mse: 10.03, relerr: 32.37%, relerr10: 14.67%, r2: 0.8778
epoch: 480, mae: 5.52, mse: 10.09, relerr: 33.53%, relerr10: 14.71%, r2: 0.8753
epoch: 490, mae: 5.96, mse: 10.62, relerr: 30.87%, relerr10: 16.10%, r2: 0.8741
epoch: 500, mae: 5.58, mse: 10.22, relerr: 29.42%, relerr10: 15.37%, r2: 0.8765
best mae: 5.09, best mse: 9.06, best_relerr: 33.81, best_relerr10: 14.09, best_r2: 0.8880
overall best mae: 5.09, overall best mse: 8.95, overall best_relerr: 28.17, overall best_relerr10: 14.09, overall best_r2: 0.9062

train

Run the following command to train TasselNetv2+ on the WEC/MTC/SHC dataset:

sh config/hl_wec_train.sh

sh config/hl_mtc_train.sh

sh config/hl_shc_train.sh

Insert image description here

Use your own data set

To use this framework on your own dataset, you may need to:

  1. Label your data with dotted annotations. I recommend using VGG Image Annotator ;
  2. Generate gen_trainval_list.pytraining/validation lists like in the example;
  3. hldataset.pyWrite your data loader according to the sample code in;
  4. Calculate the mean and standard deviation of RGB on the training set;
  5. Create a new entry hltrainval.pyin ;dataset_list
  6. ./configCreate a new one following the example in your_dataset.shand modify the hyperparameters as needed (e.g. batch size, crop size).
  7. Train and test your model. have fun:)

Quote

If you find this work or code useful in your research, please cite:

@article{lu2020tasselnetv2plus,
  title={TasselNetV2+: A fast implementation for high-throughput plant counting from high-resolution RGB imagery},
  author={Lu, Hao and Cao, Zhiguo},
  journal={Frontiers in Plant Science},
  year={2020}
}

@article{xiong2019tasselnetv2,
  title={TasselNetv2: in-field counting of wheat spikes with context-augmented local regression networks},
  author={Xiong, Haipeng and Cao, Zhiguo and Lu, Hao and Madec, Simon and Liu, Liang and Shen, Chunhua},
  journal={Plant Methods},
  volume={15},
  number={1},
  pages={150},
  year={2019},
  publisher={Springer}
}

Guess you like

Origin blog.csdn.net/qq_36315683/article/details/135354472