Image Classification
Keras
English
cvt
tensorflow
computer-vision
image-processing
corn-kernel-classification
Instructions to use erukude/cornvit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use erukude/cornvit with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://erukude/cornvit") - Notebooks
- Google Colab
- Kaggle
CornViT
A Multi-Stage Convolutional Vision Transformer Framework for Corn Kernel Analysis
Overview
Three-stage hierarchical classification pipeline for automated corn kernel quality assessment:
- Stage 1: Purity detection (Pure vs Impure)
- Stage 2: Shape classification (Flat vs Round)
- Stage 3: Embryo orientation (Up vs Down)
Architecture
- Model: CvT-13 (384Γ384) with ImageNet-22k pretraining
- Framework: PyTorch + Microsoft CvT
- Test Accuracy: 93.8% (Stage 1), 94.1% (Stage 2), 91.1% (Stage 3)
Setup
# Clone repository
git clone https://github.com/microsoft/CvT.git
# Install dependencies
pip install -r requirements.txt
Training
Each stage has independent training scripts:
python stage1/train_cvt13.py # Purity classification
python stage2/train_cvt13.py # Shape classification
python stage3/train_cvt13.py # Embryo orientation
Inference
python stage1/inference_cvt13.py
python stage2/inference_cvt13.py
python stage3/inference_cvt13.py
Baselines
ResNet50 and DenseNet121 baselines available in baselines/.
Structure
βββ stage1/ # Purity classification
βββ stage2/ # Shape classification
βββ stage3/ # Embryo orientation
βββ preprocess/ # Data preprocessing scripts
Requirements
- Python 3.13+
- PyTorch 2.9+
- CUDA (optional, for GPU training)
Citation
If you use this code, models, or catalog in your research, please cite:
@Article{computers15010002,
AUTHOR = {Erukude, Sai Teja and Mascarenhas, Jane and Shamir, Lior},
TITLE = {CornViT: A Multi-Stage Convolutional Vision Transformer Framework for Hierarchical Corn Kernel Analysis},
JOURNAL = {Computers},
VOLUME = {15},
YEAR = {2026},
NUMBER = {1},
ARTICLE-NUMBER = {2},
URL = {https://www.mdpi.com/2073-431X/15/1/2},
ISSN = {2073-431X},
DOI = {10.3390/computers15010002}
}
- Downloads last month
- 135