| --- |
| library_name: pytorch |
| pipeline_tag: image-classification |
| tags: |
| - efficientnet |
| - efficientnet-b3 |
| - plant-classification |
| - agriculture |
| --- |
| |
| # Plant Classifier — EfficientNet-B3, 39 classes |
|
|
| Frozen PyTorch checkpoint for plant/crop classification. The model was trained with supervised contrastive pretraining, cross-entropy fine-tuning, and TrivialAugment. |
|
|
| ## Intended use |
|
|
| The model predicts the plant identity before a crop-specific disease detector and recommendation system. It is a plant classifier, not a disease classifier. |
|
|
| ## Input preprocessing |
|
|
| - Convert the image to RGB. |
| - Resize the longest side to 380 pixels while preserving aspect ratio. |
| - Pad to 380 × 380 with black pixels. |
| - Normalize with ImageNet mean `(0.485, 0.456, 0.406)` and standard deviation `(0.229, 0.224, 0.225)`. |
| - Do not apply training augmentation during inference. |
|
|
| The checkpoint contains `model` and `class_to_idx`. Reconstruct `torchvision.models.efficientnet_b3(weights=None)`, replace the final classifier with a 39-output linear layer, and load `checkpoint["model"]`. |
|
|
| For confidence scores, apply softmax directly to the logits. The deployed API intentionally uses raw, uncalibrated probabilities. |
|
|
| ## Frozen evaluation |
|
|
| | Metric | Result | |
| |---|---:| |
| | Validation macro F1 | 0.933455 | |
| | Test macro F1 | 0.929491 | |
| | Test macro recall | 0.930658 | |
| | Test accuracy | 0.931547 | |
| | Test top-3 accuracy | 0.981436 | |
|
|
| ## Files |
|
|
| - `model.pt`: frozen EfficientNet-B3 checkpoint. |
| - `class_to_idx.json`: authoritative output-index mapping. |
| - `model_config.json`: architecture and preprocessing contract. |
| - `SHA256SUMS`: checkpoint integrity checksum. |
| - `FROZEN_MODEL.md`: frozen-run provenance and metrics. |
|
|
|
|