Skip to content

About

CNN-based system for automated beetle detection and elytra coordinate prediction for morphological trait analysis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

Efficient CNN-Based System for Automated Beetle Elytra Coordinates Prediction

This repository contains code and resources for our deep learning framework to localize beetles in images (object detection) and predict elytra coordinates (regression), enabling automated measurement of beetle morphological traits.


1. Installation

Install via pip:

pip install torch opencv-python tqdm

2. Dataset

Our dataset is hosted on Hugging Face for easy download and version control.
Hugging Face Dataset Link

It includes:

  • High-resolution images containing multiple beetles (grouped and individual).
  • Corresponding bounding box annotations for object detection.
  • Manually annotated elytra coordinates for regression tasks.

It is re-created from the original beetle dataset found here:
2018-NEON-beetles

3. Pre-trained Models

We provide two sets of pre-trained models:

  1. Object Detection Models (YOLO)
  2. Regression Models (for beetle elytra coordinates)

3.1. Object Detection (YOLO)

Below is a summary of YOLOv8 models we trained (or fine-tuned) for beetle detection, along with their AP50 and mAP on our test set.

Model AP50 mAP
YOLOv8n 0.968 0.800
YOLOv8s 0.970 0.805
YOLOv8m 0.971 0.804

Pre-trained weights are available on Hugging Face: https://huggingface.co/yoohj0416/predictbeetle

For additional details on how to install and run YOLOv8, please refer to the official Ultralytics YOLOv8 documentation.

3.2 Regression Models

Below is a summary table for our Regression Models using various backbones. Each row includes its corresponding Mean Squared Error (MSE) and Points Difference performances on our test set.

Backbone MSE Points Difference (cm) Params
ResNet50 1.941E-03 0.128 23.5M
ResNet101 1.971E-03 0.132 42.5M
MobileNetV3-Large 1.952E-03 0.118 4.2M
EfficientNetV2-S 1.870E-03 0.110 20.2M
EfficientNetV2-M 1.756E-03 0.110 52.9M

Pre-trained weights are available on Hugging Face: https://huggingface.co/yoohj0416/predictbeetle

4. Train & Test

A. Update the Config File

Before training or testing, edit your config file (e.g., config.yaml) and ensure:

dataset:
  source_dir: /absolute/path/to/individual/images

Here, source_dir should point to the folder where you downloaded and extracted the individual images from our dataset on Hugging Face.

B. Train

Run:

python train.py --config /path/to/config/file
  • Parses the specified config file
  • Loads the dataset
  • Initializes and trains the selected model (backbone, epochs, etc.)

C. Test / Inference

For inference or to evaluate a trained model, run:

python predict.py --config /path/to/config/file
  • Loads the trained weights from the config
  • Runs prediction on the test set or custom images
  • Outputs bounding boxes or elytra keypoints, plus measurement logs

4. Citation

BibTeX:

@inproceedings{Yoo2025EfficientCNN,
  author    = {Yoo, H. and Somasundaram, D. and Oh, H.},
  title     = {{Efficient CNN-Based System for Automated Beetle Elytra Coordinates Prediction}},
  booktitle = {Proceedings of the 20th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications ({VISIGRAPP} 2025) - Volume 2: {VISAPP}},
  pages     = {934--941},
  year      = {2025},
  publisher = {{SCITEPRESS – Science and Technology Publications, Lda.}},
  doi       = {10.5220/0013264600003912},
  isbn      = {978-989-758-728-3},
  issn      = {2184-4321},
  series    = {{VISIGRAPP} 2025}
}

Original Dataset:

@misc{Fluck2018_NEON_Beetle,
  author = {Isadora E. Fluck and Benjamin Baiser and Riley Wolcheski and Isha Chinniah and Sydne Record},
  title = {2018 {NEON} Ethanol-preserved Ground Beetles (Revision 7b3731d)},
  year = {2024},
  url = {https://huggingface.co/datasets/imageomics/2018-NEON-beetles},
  doi = { 10.57967/hf/5252 },
  publisher = {Hugging Face}
}

Specimens:

@misc{Portal2022-ho,
  title     = "{NEON} biorepository Carabid collection (trap sorting)",
  author    = "Portal, Neon Biorepository",
  publisher = "National Ecological Observatory Network",
  doi = {https://doi.org/10.15468/mjtykf},
  note = {Accessed in 2022}
}
@misc{Portal2022-qu,
  title     = "{NEON} Biorepository Carabid Collection (Archive Pooling)",
  author    = "Portal, Neon Biorepository",
  publisher = "National Ecological Observatory Network",
  doi = {https://doi.org/10.15468/xicbza},
  note = {Accessed in 2022}
}

5. Acknowledgements

This work was supported by the NSF OAC 2118240 Imageomics Institute award and was initiated at Beetlepalooza 2024. More details about Beetlepalooza can be found on https://github.com/Imageomics/BeetlePalooza-2024.

This material is based in part upon work supported by the U.S. National Ecological Observatory Network (NEON), a program sponsored by the U.S. National Science Foundation (NSF) and operated under cooperative agreement by Battelle. Furthermore, this material uses specimens and/or samples collected as part of the NEON Program.

Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

About

CNN-based system for automated beetle detection and elytra coordinate prediction for morphological trait analysis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages