pbc-cell-classifier / README.md
esab's picture
Upload README.md
12819b7 verified
# ResNet-18 Peripheral Blood Cell Classifier
## Model Description
This is a ResNet-18 model fine-tuned for peripheral blood cell (PBC) classification using fastai. The model can classify blood cell images into 8 different cell types with 98.07% validation accuracy.
## Model Details
- **Model Type**: ResNet-18 with transfer learning
- **Framework**: fastai (version <2.8.0)
- **Task**: Image Classification
- **Dataset**: Peripheral Blood Cell (PBC) dataset
- **Classes**: 8 cell types
- **Validation Accuracy**: 98.07%
## Cell Types
The model can classify the following blood cell types:
1. **Basophil** - A type of white blood cell involved in inflammatory reactions
2. **Eosinophil** - White blood cells that fight parasites and allergic reactions
3. **Erythroblast** - Immature red blood cells
4. **IG (Immature Granulocyte)** - Immature white blood cells
5. **Lymphocyte** - White blood cells that fight infections
6. **Monocyte** - Large white blood cells that become macrophages
7. **Neutrophil** - Most common white blood cells that fight bacterial infections
8. **Platelet** - Cell fragments that help blood clotting
## Training Details
- **Training Images**: 13,674
- **Validation Images**: 3,418
- **Architecture**: Pretrained ResNet-18 backbone with custom head
- **Training Strategy**:
- 4 epochs with frozen backbone
- 6 epochs with fine-tuning
- **Input Size**: 224x224 pixels
- **Preprocessing**: Standard ImageNet normalization
## Performance
- **Validation Accuracy**: 98.07%
- **All cell types**: >95% precision and recall
- **Best performers**: Eosinophil and Platelet (100% precision)
## Usage
```python
from fastai.vision.all import *
# Load the model
learn = load_learner('cell_classifier.pkl')
# Predict on an image
pred, pred_idx, probs = learn.predict('path/to/blood_cell_image.jpg')
print(f"Predicted: {pred}")
print(f"Confidence: {probs[pred_idx]:.2%}")
```
## Requirements
```
fastai>=2.7.0,<2.8.0
numpy<2.0
pillow>=10.0.0
```
## Model Files
- `cell_classifier.pkl` - Complete fastai learner with model and preprocessing
- `cell_classifier_weights.pth` - PyTorch weights only
- `confusion_matrix.png` - Validation confusion matrix
- `classification_report.csv` - Detailed classification metrics
- `training_summary.json` - Training configuration and results
## Citation
If you use this model, please cite:
```bibtex
@misc{pbc-cell-classifier-2024,
title={ResNet-18 Peripheral Blood Cell Classifier},
author={Your Name},
year={2024},
howpublished={Hugging Face Hub},
url={https://huggingface.co/your-username/pbc-cell-classifier}
}
```
## License
This model is released under the MIT License.
## Created For
HuggingFace Agents-MCP-Hackathon Track 1 - MCP Tool/Server