Downloads · 30 days
0
TanmayNanda/LARS-MobileNet-V4
LARS-MobileNet-V4 is a machine learning model from TanmayNanda. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This repository contains the implementation of the lightweight convolutional neural network architecture described in the paper "Advancing Real-Time Crop Disease Detection on Edge Computing Devices using Lightweight C…
Downloads · 30 days
0
Access
Public
Updated Oct 11, 2025
Repo size
10.2 MB
Likes
0
Public
Click a slice to open those files.
.pth10.2 MB · 100%
From the Hugging Face model README
This repository contains the implementation of the lightweight convolutional neural network architecture described in the paper "Advancing Real-Time Crop Disease Detection on Edge Computing Devices using Lightweight Convolutional Neural Networks."
https://github.com/lars-uav/LARS-MobileNet-V4
This project introduces LARS-MobileNetV4, an optimized version of MobileNetV4 specifically designed for real-time crop disease detection on resource-constrained edge devices such as Raspberry Pi. Our implementation achieves 97.84% accuracy on the Paddy Doctor dataset while maintaining fast inference times (88.91ms on Raspberry Pi 5), making it suitable for deployment in agricultural field settings.
LARS-MobileNetV4 builds upon the recently introduced MobileNetV4 architecture with several key optimizations:
| Model | Parameters (M) | Accuracy (%) | Model Size (MB) | Inference Time on CPU (ms) | Inference Time on Raspberry Pi 5 (ms) |
|---|---|---|---|---|---|
| ResNet34 | 21.79 | 97.50 | 85.3 | 148.93 | 264.50 |
| MobileNet-V2 | 3.5 | 92.42 | 9.2 | 40.00 | 73.09 |
| MobileNet-V3 | 2.5 | 95.62 | 10.3 | N/A | N/A |
| MobileNet-V4 | 3.8 | 97.17 | 10.2 | 39.20 | 88.91 |
| LARS-MobileNet-V4 | 3.8 | 97.84 | 10.2 | 39.20 | 88.91 |
Our implementation includes several optimization techniques:
| Model Variation | Train Accuracy (%) | Test Accuracy (%) |
|---|---|---|
| MobileNet-V4 Baseline | 99.93 | 97.17 |
| MobileNet-V4 (Augmentations) | 99.60 | 97.21 |
| MobileNet-V4 (FocalLabelSmoothingLoss) | 99.71 | 97.79 |
| MobileNet-V4 (Augmentations, FocalLabelSmoothingLoss, Squeeze-Excitation Blocks) | 99.68 | 97.84 |
We implement a combination of Focal Loss and Label Smoothing:
Label Smoothing: Redistributes confidence across classes
$$y_{smooth} = (1 - ε)y + ε/C$$
where ε is the smoothing factor and C is the total number of classes.
Focal Loss: Focuses on harder examples
$$L_{focal}(pt) = -α(1 - pt)^γ log(pt)$$
where pt is the predicted probability for the true class.
Combined Loss (FLS):
$$L_{FLS} = -α(1 - pt)^γ log(p_{smooth})$$
torch
torchvision
timm
numpy
pandas
Pillow
scikit-learn
tqdm
wandb
Organize your data as follows:
├── train_images/
│ ├── disease_class_1/
│ │ ├── image1.jpg
│ │ ├── image2.jpg
│ │ └── ...
│ ├── disease_class_2/
│ └── ...
├── test_images/
└── train.csv
The train.csv file should contain:
image_id: Filename of the imagelabel: Disease class nameKey hyperparameters can be modified at the top of the script:
LEARNING_RATE = 0.0001
ARCHITECTURE = "MobileNetV4"
EPOCHS = 50
BATCH_SIZE = 64
OPTIMISER = "Adam"
LOSS_FUNCTION = "FocalLabelSmoothingComboLoss"
NUM_CLASSES = 13 # 12 disease classes + 1 normal class
PRETRAINED = True
If you use this code in your research, please cite our paper:
@article{Nanda, T.R., Shukla, A., Srinivasa, T.R., Bhargava, J., Chauhan, S. (2025).
Advancing Real-Time Crop Disease Detection on Edge Computing Devices Using Lightweight Convolutional Neural Networks.
In: Arai, K. (eds) Intelligent Systems and Applications. IntelliSys 2025.
Lecture Notes in Networks and Systems, vol 1567. Springer, Cham. https://doi.org/10.1007/978-3-032-00071-2_33
}