File size: 2,738 Bytes
12819b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# 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