- Multiple Frameworks: PyTorch and TensorFlow implementations
- Custom Architecture: Specialized ResNet9 PyTorch model for blood group detection
- Pre-trained Models: EfficientNetB0, ResNet50, DenseNet121, InceptionV3, MobileNetV2, VGG16 (via TensorFlow ensemble)
- Ready-to-use CLI: Unified inference script (
scripts/predict.py) for easy testing
BloodPrint/
├── src/
│ ├── __init__.py # Package initialization
│ └── models.py # PyTorch model architectures
├── scripts/
│ └── predict.py # Unified CLI for inference (PyTorch & TF)
├── notebooks/ # Source of truth for training & evaluation
│ ├── pytorch.ipynb
│ └── tensorflow.ipynb
├── model/ # Trained Model Weights
│ ├── pytorch.pth # Trained PyTorch model weights (25.1 MB)
│ └── tensorflow.h5 # Trained TensorFlow model weights (42.1 MB)
├── examples/ # Sample test images
│ └── a+.bmp
├── papers/ # Research papers and related documents
├── README.md # Project documentation (You are here)
└── requirements.txt # Python dependencies
- macOS / Linux / Windows
- Python 3.10 or 3.11 (TensorFlow is not yet fully supported on Python 3.12+ for all architectures)
- CUDA-compatible GPU (optional, recommended for training)
git clone https://github.com/kr1shnasomani/BloodPrint.git
cd BloodPrintIt is highly recommended to use a virtual environment to manage dependencies and avoid version conflicts.
For macOS/Linux:
# Create the virtual environment using Python 3.11
python3.11 -m venv venv
# Activate the virtual environment
source venv/bin/activateFor Windows:
# Create the virtual environment
python -m venv venv
# Activate the virtual environment
venv\Scripts\activateOnce the virtual environment is activated (you should see (venv) in your terminal prompt), install the required packages:
pip install --upgrade pip
pip install -r requirements.txtYou can test the models using the provided predict.py script. The script automatically handles the correct image resizing required by each framework (128x128 for PyTorch, 64x64 for TensorFlow).
Using PyTorch (Default):
python scripts/predict.py examples/a+.bmpUsing TensorFlow:
python scripts/predict.py examples/a+.bmp --framework tensorflowExpected Output Example:
File: examples/a+.bmp
Framework: Pytorch
Predicted Blood Group: A+ (Confidence: 99.85%)
- Architecture: Custom ResNet9
- Input Size: 128x128
- Accuracy: 85%
- Architecture: Ensemble of pre-trained models
- Input Size: 64x64
- Validation Accuracy: 83%
See notebooks/pytorch.ipynb and notebooks/tensorflow.ipynb for detailed classification reports and confusion matrices.
