We introduce a grouped dropout strategy and modify the CNN architecture to improve the accuracy of multi-class insect recognition. Leveraging the Inception module’s branching structure and the adaptive grouping properties of the WeDIV clustering algorithm, we developed two grouped dropout models, the iGDnet-IP and GDnet-IP. Experimental results on a dataset containing 20 insect species (15 pests and five beneficial insects) with 73,635 images demonstrated an increase in cross-validation accuracy from 84.68% to 92.12%, with notable improvements in the recognition rates for difficult-to-classify species. Our model showed significant accuracy advantages over standard dropout methods on independent test sets, with much less training time compared to four conventional CNN models, highlighting the suitability for mobile applications.
Grouped dropout-based CNN for insect pest recognition. (A) Architecture of GDnet-IP; (B) Inception-based GDnet-IP, where the grey branch is randomly deactivated; (C) Clustering-based GDnet-IP, where the channels in 'Group 2' are randomly deactivated.
- Python 3.7+
- Required libraries:
- PyTorch
- NumPy
- SciPy
- Pandas
- Clone the repository:
git clone https://github.com/ZhijunBioinf/GDnet-IP.git
cd GDnet-IP
- Install dependencies:
pip install -r requirements.txt
Organize your insect images into folders based on their class. For example:
data/
├── ants/
│ ├── image1.jpg
│ ├── image2.jpg
├── bees/
│ ├── image1.jpg
│ ├── image2.jpg
To train the model, run:
python GDnet-IP.py --train
To test the model on new images, run:
python GDnet-IP.py --test
Adjust training parameters such as batch size and learning rate by modifying the config.py
file or using command-line arguments.
This project was developed by:
- Dongcheng Li (dongchengli287@gmail.com) - Implementing
- Zhijun Dai (daizhijun@hunau.edu.cn) - Supervisor
We welcome contributions from the community! Feel free to submit pull requests or raise issues.
Dongcheng Li, Yongqi Xu, Zheming Yuan, Zhijun Dai*. GDnet-IP: Grouped Dropout-Based Convolutional Neural Network for Insect Pest Recognition. Agriculture, 2024, 14(11), 1915.