Sorghum kernel defect classifiers: trained models and result tables

This repository belongs to our paper Teacher Selection and Class-Imbalance-Aware Knowledge Distillation for Sorghum Kernel Defect Classification. It holds the trained models, their ONNX versions, the result tables and a small script that runs a model on example images. The best small student reaches 97.87% macro-F1 on the GrainSet sorghum test set. It is statistically tied with its 27.87 M-parameter teacher (p = 0.52) at about one seventh of the parameters. We do not redistribute the GrainSet images; they are available from the original authors (Fan et al., Scientific Data 2023, CC BY 4.0).

What is inside

og_models/         trained PyTorch checkpoints (.pt), grouped by task
onnx_models/       the same models exported to ONNX (framework independent)
results_csv/       training histories, significance tests and summary tables (CSV)
sample_images/     a few test images to try the models on
MAPPING.md         table of every checkpoint: architecture, validation macro-F1, file size
mapping.json       the same table in machine-readable form
infer_example.py   loads one ONNX model and classifies one image
test_inference.py  runs every ONNX model on the sample images and reports accuracy
requirements.txt   packages needed for the two scripts

The checkpoints fall in four groups: cnn_baselines, kd_students and vit_models (all trained for a fixed budget of five epochs), and convergence_checkpoints (the same recipes retrained with early stopping, to check that five epochs had not already converged). The convergence checkpoints are provided as PyTorch files only, with no ONNX version. MAPPING.md lists every file and its architecture. The validation macro-F1 is recorded for 57 of the 82 five-epoch checkpoints, because not every training run saved it inside the file; a missing value does not mean the model was not tested.

Preprocessing

  • Resize to 224 x 224, RGB.
  • Normalise with mean = [0.308562, 0.251994, 0.187898] and std = [0.240441, 0.197289, 0.149387]. These are statistics computed on GrainSet, not the usual ImageNet values.
  • Class order (index 0 to 7, the argmax of the output): NOR, F&S, SD, MY, AP, BN, HD, IM (normal, fusarium-and-shrivelled, sprouted, moldy, pest-attacked, broken, heat-damaged, impurities).

Quick start

pip install -r requirements.txt
python infer_example.py      # one model, one image
python test_inference.py     # every model on the sample images, with accuracy

Main result in short

In 9 of 10 comparisons, convergence training was significantly better than the five-epoch budget (McNemar's test, p between 0.05 and 1e-24). It lifted SE-ResNet-50 from 80.49% to 94.23% macro-F1, and plain EfficientNet-B0 from 88.14% to 98.55%. The paper gives the full tables, tests and discussion.

What is not released

The GrainSet images, and the training notebooks (they ran on Kaggle and are not all archived). The checkpoints and result tables they produced are all here.

Licence

CC0 1.0 for the models and tables in this repository. The GrainSet data are under CC BY 4.0 from their original publication.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support