Skip to content

A machine learning application for classifying Diapriidae family insects at the genus level and determining their sex using image data.

Notifications You must be signed in to change notification settings

hosseinshirali/DiapriidaeClassificationApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diapriidae and Ismaridae Genus and Sex Classification and Outlier Detection

This repository contains a machine learning application for predicting the genus and sex of Diapriidae and Ismaridae images using the Vision Transformer Architecture BEiTV2 and outlier detection (predict whether an insect does not belong to any of the learned classes). The application provides a user-friendly web interface for both single-image and batch processing.

This repository is based on the work published in the following paper:

"Image-based recognition of parasitoid wasps using advanced neural networks"

You can access the full text of the paper here: Full Text.

Original Repository

The original repository for this project is hosted on GitLab. You can find it here:

GitLab Repository

Table of Contents

Getting Started

Prerequisites

Before running the application, you need to have the following prerequisites:

  • Anaconda Package Manager (Download)
  • If using Microsoft Windows OS: Microsoft Visual C++ Redistributable (In many cases already installed. You can install it here)

Installation

  1. Open Windows PowerShell.

  2. Create a new folder for this project at your desire path and navigate to it in Windows PowerShell:

    mkdir <path/to/diapriidae_classification_app>
    cd <path/to/diapriidae_classification_app>
  3. Clone the repository to your local machine:

    git clone https://gitlab.kit.edu/kit/iai/ber/diapriidaeclassificationapp.git
    cd diapriidaeclassificationapp
  4. Create a virtual environment using Anaconda and activate it:

    conda create -n diapriidae_app python=3.10 anaconda --yes
    conda activate diapriidae_app
  5. Install the required dependencies from requirements.txt:

    pip install -r requirements.txt
  6. Download the GroundingDINO weights file. If the provided link does not work, check the GroundingDINO Installation Guide (Step 4: Download pre-trained model weights).

    curl -O weights/groundingdino_swint_ogc.pth https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
  7. Start the application:

    python src/app.py

As soon as the Application is running a browser window should open automatically. You can perform genus/sex classification and outlier detection on single images or perform batch inference on multiple images or alternatively on all images inside a directory.

Usage

Single Image Prediction

  1. You will see two tabs: "Single Image" and "Image Folder." Select the "Single Image" tab.

  2. Drag and drop an image into the designated box.

  3. Click the "Predict" button to initiate the inference process.

  4. The classification and outlier detection results will be displayed on the screen based on the image.

Single Image Prediction Example

Batch Inference

  1. Select the "Image Batch" tab.

  2. Inside the "Image data type" box specify if multiple images or all Images inside a directory should be predicted.

  3. Click the "Browse" button and specify the images or the image folder to serve as input.

  4. The application will process the specified images and generate prediction results in Excel file inside the output folder. The path of the Excel file will be displayed on the screen as soon as it is created.

Single Image Prediction Example

About

A machine learning application for classifying Diapriidae family insects at the genus level and determining their sex using image data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages