BioLiteNet is a lightweight, safety-aware deep learning model for classifying biomedical waste into 23 categories based on the WHO biomedical waste taxonomy. It combines:
- MobileNetV3-Large as the efficient backbone
- CBAM (Convolutional Block Attention Module) inserted at stages 3, 6, and 12 for fine-grained spatial and channel attention
- HAFL (Hazard-Aware Focal Loss), a novel loss function that penalizes misclassification of high-risk waste categories (e.g., sharps, pathological) more heavily than general waste
BioLiteNet achieves 96.97% accuracy and a Sharps-F1 of 0.9864 on the background-removed split of the Biomedical Waste Dataset β making it suitable for real-time deployment in resource-constrained hospital settings.
BioLiteNet mathematically out-performs recent architectures:
- Vs. Khonjun et al. (2025): Matches their 98.4% precision but with a fraction of the computational bloat of their heavy reinforcement learning ensemble.
- Vs. Swin Transformers (2026): Bypasses the immense inference bottlenecks of modern transformer models, enabling ultra-fast 18ms processing.
- Vs. Reddy et al. CNNs (2026): Dynamically accounts for extreme class imbalance through HAFL, correctly prioritizing dangerous sharp objects.
Input Image (224Γ224Γ3)
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β MobileNetV3-Large Backbone β
β β
β Stage 0 βββΆ Stage 1 βββΆ Stage 2 β
β β
β Stage 3 βββΆ [CBAM] βββΆ ... β β Channel + Spatial Attention
β β
β Stage 6 βββΆ [CBAM] βββΆ ... β β Channel + Spatial Attention
β β
β Stage 12 βββΆ [CBAM] βββΆ Stage 13-16 β β Channel + Spatial Attention
βββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
AdaptiveAvgPool2d(1)
β
βΌ
Dropout(0.4)
β
βΌ
Linear(960 β 23)
β
βΌ
HAFL Loss: L = -h_c Β· Ξ±_t Β· (1 - p_t)^Ξ³ Β· log(p_t)
where h_c = WHO hazard weight per class
Feature Map (B, C, H, W)
β
βΌ
ChannelGate β scale by important channels
β
βΌ
SpatialGate β scale by important spatial regions
β
βΌ
Refined Feature Map
| Variant | CBAM | HAFL | Accuracy | Macro-F1 | Sharps-F1 |
|---|---|---|---|---|---|
| A β Baseline | β | β | β | β | β |
| B β CBAM only | β | β | β | β | β |
| C β HAFL only | β | β | β | β | β |
| D β BioLiteNet | β | β | 96.97% | 0.9680 | 0.9864 |
Run
python main.py --all-variantsto reproduce the full ablation study.
| Class | F1 | Risk Category |
|---|---|---|
| stitch_removal_scissors | 1.0000 | π΄ Sharps |
| used_masks | 1.0000 | π‘ General |
| uncategorized_or_overlapping | 0.9978 | π‘ General |
| hemostats | 0.9948 | π΄ Sharps |
| episiotomy_scissors | 0.9948 | π΄ Sharps |
| scalpels | 0.9948 | π΄ Sharps |
| used_syringes | 0.9897 | π΄ Sharps |
| forceps | 0.9843 | π΄ Sharps |
| ... | ... | ... |
| human_organs | 0.9026 | π Pathological |
| waterbottles | 0.9149 | π‘ General |
This project uses the Biomedical Waste Dataset available on Kaggle:
π Download from Kaggle
After downloading:
- Place
archive.zipinside thedata/folder:BioLiteNet/ βββ data/ βββ archive.zip β place here - The training script will auto-extract and split the dataset (70/15/15).
Dataset statistics (per class, 22 classes Γ 640 images + uncategorized Γ 1520):
| Split | Images |
|---|---|
| Train | ~10,360 |
| Val | ~2,220 |
| Test | ~2,340 |
git clone https://github.com/muhammadawaisofficial/BioLiteNet.git
cd BioLiteNetpip install -r requirements.txtdata/archive.zip
python main.py --variant Djupyter notebook BioLiteNet.ipynbRun all cells β training auto-resumes from checkpoint if one exists.
All hyperparameters are in config.py:
| Parameter | Value | Description |
|---|---|---|
IMG_SIZE |
224 | Input resolution |
BATCH_SIZE |
16 | Training batch size |
NUM_EPOCHS |
30 | Total training epochs |
LR |
1e-3 | Initial learning rate (AdamW) |
LR_MIN |
1e-6 | Cosine annealing minimum LR |
DROPOUT_RATE |
0.4 | Classifier dropout |
FOCAL_GAMMA |
2.0 | Focal loss focusing parameter |
CBAM_STAGES |
[3, 6, 12] | MobileNetV3 stages where CBAM is inserted |
SEED |
42 | Global random seed |
BioLiteNet/
β
βββ BioLiteNet.ipynb # Self-contained notebook (recommended entry point)
β
βββ config.py # All hyperparameters and paths
βββ model.py # BioLiteNet, CBAM, ChannelGate, SpatialGate
βββ loss.py # HazardAwareFocalLoss (HAFL) + FocalLoss
βββ dataset.py # Dataset extraction, splitting, dataloaders
βββ trainer.py # Training loop, evaluation, checkpointing
βββ main.py # CLI entry point (argparse)
βββ results_table.py # Ablation study table generator
β
βββ data/ # Dataset (not tracked by git β see .gitignore)
β βββ archive.zip β place Kaggle download here
β
βββ outputs/ # Training outputs (results tracked, checkpoints not)
β βββ split_stats.json
β βββ D_BioLiteNet/
β βββ training_log.csv
β βββ test_report.txt
β βββ per_class_f1.json
β βββ confusion_matrix.npy
β
βββ requirements.txt
βββ LICENSE
βββ README.md
# Train the full BioLiteNet model (Variant D)
python main.py --variant D
# Train all 4 ablation variants
python main.py --all-variants
# Skip dataset extraction (if already extracted)
python main.py --variant D --skip-extract
# Train a specific variant
python main.py --variant A # Baseline (no CBAM, no HAFL)
python main.py --variant B # CBAM only
python main.py --variant C # HAFL only
python main.py --variant D # BioLiteNet (CBAM + HAFL)Training auto-resumes from the last saved checkpoint β so interrupting and restarting is safe.
Standard focal loss treats all misclassifications equally. HAFL introduces a per-class hazard weight
| Risk Category | Classes | |
|---|---|---|
| π΄ Sharps (highest) | used_syringes, scalpels, scissors, forceps, hemostats | 2.8 β 3.0 |
| π Pathological | human_organs, blood_soaked_bandages | 2.5 |
| π‘ Chemical | disinfectant_bottles, ampoules | 2.0 β 2.2 |
| π’ Pharmaceutical | expired_tablets, vials, syrup_bottles | 1.5 |
| βͺ General | masks, gloves, paper, organic waste | 1.0 β 1.3 |
This ensures the model is more heavily penalized for missing high-hazard classes like sharps (direct injury + bloodborne pathogen risk).
torch>=2.0.0
torchvision>=0.15.0
numpy>=1.24.0
scikit-learn>=1.3.0
Pillow>=10.0.0
Windows note: Set
NUM_WORKERS = 0inconfig.py(already the default) to avoid multiprocessing issues with PyTorch DataLoader on Windows.
If you use BioLiteNet in your research, please cite:
@article{biolite2026,
title = {BioLiteNet: Lightweight Biomedical Waste Classification with
Attention and Hazard-Aware Focal Loss},
author = {Your Name and Co-authors},
journal = {Journal / Conference Name},
year = {2026},
url = {https://github.com/muhammadawaisofficial/BioLiteNet}
}This project is licensed under the MIT License β see LICENSE for details.