Skip to content

Repository files navigation

Corn DON Concentration Prediction Model

This repository contains a machine learning model for predicting DON (Deoxynivalenol or vomitoxin) concentration in corn samples using spectral reflectance data.

Project Overview

This project analyzes spectral reflectance data from corn samples to predict DON concentration levels. The model uses a Convolutional Neural Network (CNN) architecture to process spectral data and predict contamination levels.

Repository Structure

  • main.ipynb: Jupyter notebook containing the complete analysis pipeline
  • dataset.csv: Dataset with spectral reflectance values and DON concentration measurements
  • model_cnn.keras: Saved trained CNN model
  • scaler.pkl: Saved StandardScaler object for preprocessing new data

Installation Requirements

Setting up the environment

  1. Clone this repository:

    git clone https://github.com/arnnv/Corn-DON-Concentration-Prediction.git
    cd Corn-DON-Concentration-Prediction
    
  2. Create and activate a virtual environment (recommended):

    python -m venv venv
    
    # On Windows
    venv\Scripts\activate
    
    # On macOS/Linux
    source venv/bin/activate
    
  3. Install required packages:

    pip install -r requirements.txt
    

Running the Code

  1. Launch Jupyter Notebook:

    jupyter notebook
    
  2. Open and run main.ipynb

The notebook is structured to:

  1. Load and preprocess the spectral data
  2. Perform exploratory data analysis
  3. Transform the target variable
  4. Build and train a CNN model
  5. Evaluate model performance
  6. Save the model for future use

Using the Trained Model

To use the saved model for predictions on new data:

import numpy as np
import joblib
from tensorflow.keras.models import load_model

# Load the saved model and scaler
model = load_model('model_cnn.keras')
scaler = joblib.load('scaler.pkl')

# Preprocess new data (replace X_new with your new spectral data)
X_new_scaled = scaler.transform(X_new)
X_new_reshaped = X_new_scaled.reshape(X_new_scaled.shape[0], X_new_scaled.shape[1], 1)

# Make predictions
predictions = model.predict(X_new_reshaped)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages