RT-DETR Blood Cell Detection Model

Model Description

This is a fine-tuned RT-DETR (Real-Time DEtection TRansformer) model for detecting blood cells in microscopy images. The model can detect three types of cells:

  • RBC (Red Blood Cells)
  • WBC (White Blood Cells)
  • Platelets

Usage

import torch
from transformers import RTDetrForObjectDetection, AutoImageProcessor
from PIL import Image

# Load model and processor
model = RTDetrForObjectDetection.from_pretrained("Tahira96/rtdetr-blood-cell-detection")
processor = AutoImageProcessor.from_pretrained("Tahira96/rtdetr-blood-cell-detection")

# Load image
image = Image.open("blood_smear.jpg")

# Preprocess
inputs = processor(images=image, return_tensors="pt")

# Inference
with torch.no_grad():
    outputs = model(**inputs)

# Post-process results
target_sizes = torch.tensor([image.size[::-1]])
results = processor.post_process_object_detection(outputs, target_sizes=target_sizes, threshold=0.5)[0]

for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
    print(f"{model.config.id2label[label.item()]}: {score:.3f}")

Training Data

Trained on BCCD dataset.

Downloads last month
5
Safetensors
Model size
42.9M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support