Code Monkey home page Code Monkey logo

maize-classification's Introduction

Classification of defects in Zea Mays corn grain samples

Welcome to our repository which tackles corn grain classification using Digital Image Processing (DIP). This repository contains scripts, notebooks, a dataset, and a code for image acquisition using an ESP-32 CAM module.

Description

This project uses digital image processing techniques for the classification of corn grains of the Zea Mays species through the color of the grains.

Contents

Repository contents list

Folder Content
img
  • aquisition_device: images of the acquisition device
  • dataset: image database, in grayscale and in RGB, both without background
src
  • Python and Jupyter Notebook code for preprocessing, model creation, and sample classification
  • aquisition_device: PlatformIo project in C/C++ to load on ESP-32 CAM
  • tools: various functions for preprocessing and for the main code
resources Dataset in dataframe format and classification results

Dataset

The dataset contains a total of 1314 different images, which are presented in two different color spaces: RGB (color) and grayscale.

The image labels identify the percentages of defects and the quantity of grains in each sample.

Description of items for each image label
Item Description
first - a1 are samples with 30% of defective grains
- a2 are samples with 25% of defective grains
- a3 are samples with 20% of defective grains
- a4 are samples with 15% of defective grains
- a5 are samples with 10% of defective grains
- a6 to a11 are samples with all healthy grains
second Quantity of grains: 50, 60, 70, 80, 90 and 100
third Image number, for each defect percentage and grain quantity there are 20 images. Samples with healthy grains have varied quantities of images.

Getting Started

Acquisition of images for the dataset

The images illustrate the acquisition device, where the grains are placed on the blue background, and the microcontroller at the top captures the image with each new command coming through Serial Communication.

The dimensions of the box are 30x30x30 cm. Two 12 W LED lamps are used for the lighting system

Front View Setup Top View Setup
Front View Setup Top View Setup

The code to be loaded into the ESP-32 CAM is aquisition_device.

Preprocessing

After obtaining the images of the samples, preprocessing is applied, which prepares and labels the images for the model creation and classification stages. The resulting images from the preprocessing are shown below, with the grayscale image being used for classification.

RGB example Grayscale example
RGB example Grayscale example

Installation

Dependencies

You can install any missing dependencies with pip.

How to install

Follow these steps to clone the repository and install the necessary dependencies:

  1. Clone the repository:

    git clone https://github.com/ferreiradiego/maize-classification.git
    
  2. Navigate into the cloned repository:

    cd maize-classification
    
  3. Create a virtual environment:

    python3 -m venv env
    
  4. Activate the virtual environment:

    • On Windows:
      .\env\Scripts\activate
      
    • On Unix or MacOS:
      source env/bin/activate
      
  5. Install the necessary dependencies:

    pip install -r requirements.txt
    

Running the Program

The scripts required for data preprocessing and model training are located in the src directory.

You can run Jupyter notebooks in either JupyterLab or Jupyter Notebook

maize-classification's People

Contributors

ferreiradiego avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.