Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -3,8 +3,11 @@ license: apache-2.0
|
|
| 3 |
tags:
|
| 4 |
- object-detection
|
| 5 |
- medical-imaging
|
|
|
|
| 6 |
- heart-anatomy
|
| 7 |
- computer-vision
|
|
|
|
|
|
|
| 8 |
metrics:
|
| 9 |
- mean-average-precision
|
| 10 |
model-index:
|
|
@@ -21,7 +24,7 @@ model-index:
|
|
| 21 |
name: mAP@50
|
| 22 |
---
|
| 23 |
|
| 24 |
-
# Heartformer: Heart Anatomy Type Detection
|
| 25 |
|
| 26 |
**Heartformer** is a specialized object detection model for identifying and localizing different types of heart anatomy visualizations in medical images. Built on the RF-DETR (Roboflow Detection Transformer) architecture, this model can detect and classify seven distinct categories of cardiac imaging and illustration modalities.
|
| 27 |
|
|
@@ -93,9 +96,9 @@ Detection Heads
|
|
| 93 |
|
| 94 |
## 📊 Dataset
|
| 95 |
|
| 96 |
-
### Heart Anatomy Types v2 (
|
| 97 |
|
| 98 |
-
The model was trained on a curated dataset of 621 annotated images from
|
| 99 |
|
| 100 |
#### Dataset Statistics
|
| 101 |
|
|
@@ -121,6 +124,7 @@ The model was trained on a curated dataset of 621 annotated images from diffrent
|
|
| 121 |
#### Data Sources
|
| 122 |
|
| 123 |
- Medical textbooks (openly licensed)
|
|
|
|
| 124 |
- Educational anatomy databases
|
| 125 |
- All images verified for appropriate licensing
|
| 126 |
|
|
@@ -176,7 +180,7 @@ Annotations follow the COCO format:
|
|
| 176 |
|
| 177 |
### Training Details
|
| 178 |
|
| 179 |
-
- **Hardware**: Apple M3 MacBook (MPS backend)
|
| 180 |
- **Training Time**: ~1 hour 50 minutes
|
| 181 |
- **Best Epoch**: Epoch 4 (with EMA weights)
|
| 182 |
- **Early Stopping**: Triggered at epoch 11 (no improvement for 8 epochs)
|
|
@@ -250,19 +254,33 @@ The model shows excellent class separation with minimal confusion:
|
|
| 250 |
|
| 251 |
```bash
|
| 252 |
pip install torch torchvision
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
```
|
| 254 |
|
| 255 |
### Inference
|
| 256 |
|
|
|
|
| 257 |
```python
|
| 258 |
from rfdetr import RFDETRNano
|
| 259 |
-
from
|
| 260 |
|
| 261 |
# Load model
|
| 262 |
-
model = RFDETRNano(
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
)
|
| 266 |
|
| 267 |
# Run inference
|
| 268 |
detections = model.predict("heart_image.jpg", threshold=0.3)
|
|
@@ -278,6 +296,7 @@ for bbox, confidence, class_id in zip(
|
|
| 278 |
print(f"BBox: {bbox}")
|
| 279 |
```
|
| 280 |
|
|
|
|
| 281 |
### Class Names
|
| 282 |
|
| 283 |
```python
|
|
@@ -354,7 +373,7 @@ If you use Heartformer in your research or application, please cite:
|
|
| 354 |
|
| 355 |
### Acknowledgments
|
| 356 |
|
| 357 |
-
- **RF-DETR**: Based on RF-DETR architecture
|
| 358 |
```bibtex
|
| 359 |
@misc{rfdetr2024,
|
| 360 |
title={RF-DETR: Real-time Detection Transformer},
|
|
@@ -364,12 +383,12 @@ If you use Heartformer in your research or application, please cite:
|
|
| 364 |
howpublished={\url{https://github.com/roboflow/rf-detr}}
|
| 365 |
}
|
| 366 |
```
|
| 367 |
-
- **Dataset**: Heart Anatomy Types v2
|
| 368 |
- **DINOv2 Backbone**: Meta AI's self-supervised vision transformer
|
| 369 |
|
| 370 |
## 📄 License
|
| 371 |
|
| 372 |
-
This model is released under the **Apache License 2.0**,
|
| 373 |
|
| 374 |
```
|
| 375 |
Copyright 2024 Giannisan
|
|
@@ -408,4 +427,4 @@ For questions, issues, or collaboration opportunities:
|
|
| 408 |
|
| 409 |
---
|
| 410 |
|
| 411 |
-
**Note**: This model is continuously being improved. Check back for updates and new versions!
|
|
|
|
| 3 |
tags:
|
| 4 |
- object-detection
|
| 5 |
- medical-imaging
|
| 6 |
+
- rf-detr
|
| 7 |
- heart-anatomy
|
| 8 |
- computer-vision
|
| 9 |
+
datasets:
|
| 10 |
+
- roboflow/heart-anatomy-types
|
| 11 |
metrics:
|
| 12 |
- mean-average-precision
|
| 13 |
model-index:
|
|
|
|
| 24 |
name: mAP@50
|
| 25 |
---
|
| 26 |
|
| 27 |
+
# Heartformer: Heart Anatomy Type Detection with RF-DETR
|
| 28 |
|
| 29 |
**Heartformer** is a specialized object detection model for identifying and localizing different types of heart anatomy visualizations in medical images. Built on the RF-DETR (Roboflow Detection Transformer) architecture, this model can detect and classify seven distinct categories of cardiac imaging and illustration modalities.
|
| 30 |
|
|
|
|
| 96 |
|
| 97 |
## 📊 Dataset
|
| 98 |
|
| 99 |
+
### Heart Anatomy Types v2 (Roboflow)
|
| 100 |
|
| 101 |
+
The model was trained on a curated dataset of 621 annotated images from [Roboflow Universe](https://universe.roboflow.com/), specifically designed to capture the diversity of cardiac anatomy representations.
|
| 102 |
|
| 103 |
#### Dataset Statistics
|
| 104 |
|
|
|
|
| 124 |
#### Data Sources
|
| 125 |
|
| 126 |
- Medical textbooks (openly licensed)
|
| 127 |
+
- Roboflow Universe community contributions
|
| 128 |
- Educational anatomy databases
|
| 129 |
- All images verified for appropriate licensing
|
| 130 |
|
|
|
|
| 180 |
|
| 181 |
### Training Details
|
| 182 |
|
| 183 |
+
- **Hardware**: Apple M3 MacBook Pro (MPS backend)
|
| 184 |
- **Training Time**: ~1 hour 50 minutes
|
| 185 |
- **Best Epoch**: Epoch 4 (with EMA weights)
|
| 186 |
- **Early Stopping**: Triggered at epoch 11 (no improvement for 8 epochs)
|
|
|
|
| 254 |
|
| 255 |
```bash
|
| 256 |
pip install torch torchvision
|
| 257 |
+
pip install git+https://github.com/roboflow/rf-detr.git
|
| 258 |
+
pip install safetensors # For loading .safetensors format
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
### Download Model
|
| 262 |
+
|
| 263 |
+
**Recommended: SafeTensors format (safer, smaller, faster)**
|
| 264 |
+
```bash
|
| 265 |
+
wget https://huggingface.co/giannisan/heartformer/resolve/main/heartformer-v0.1.safetensors
|
| 266 |
+
```
|
| 267 |
+
|
| 268 |
+
**Alternative: PyTorch format**
|
| 269 |
+
```bash
|
| 270 |
+
wget https://huggingface.co/giannisan/heartformer/resolve/main/checkpoint_best_ema.pth
|
| 271 |
```
|
| 272 |
|
| 273 |
### Inference
|
| 274 |
|
| 275 |
+
**Using SafeTensors (Recommended)**
|
| 276 |
```python
|
| 277 |
from rfdetr import RFDETRNano
|
| 278 |
+
from safetensors.torch import load_file
|
| 279 |
|
| 280 |
# Load model
|
| 281 |
+
model = RFDETRNano(num_classes=8)
|
| 282 |
+
state_dict = load_file("heartformer-v0.1.safetensors")
|
| 283 |
+
model.load_state_dict(state_dict)
|
|
|
|
| 284 |
|
| 285 |
# Run inference
|
| 286 |
detections = model.predict("heart_image.jpg", threshold=0.3)
|
|
|
|
| 296 |
print(f"BBox: {bbox}")
|
| 297 |
```
|
| 298 |
|
| 299 |
+
**Using PyTorch Checkpoint
|
| 300 |
### Class Names
|
| 301 |
|
| 302 |
```python
|
|
|
|
| 373 |
|
| 374 |
### Acknowledgments
|
| 375 |
|
| 376 |
+
- **RF-DETR**: Based on Roboflow's RF-DETR architecture
|
| 377 |
```bibtex
|
| 378 |
@misc{rfdetr2024,
|
| 379 |
title={RF-DETR: Real-time Detection Transformer},
|
|
|
|
| 383 |
howpublished={\url{https://github.com/roboflow/rf-detr}}
|
| 384 |
}
|
| 385 |
```
|
| 386 |
+
- **Dataset**: Heart Anatomy Types v2 from Roboflow Universe
|
| 387 |
- **DINOv2 Backbone**: Meta AI's self-supervised vision transformer
|
| 388 |
|
| 389 |
## 📄 License
|
| 390 |
|
| 391 |
+
This model is released under the **Apache License 2.0**, the same license as RF-DETR.
|
| 392 |
|
| 393 |
```
|
| 394 |
Copyright 2024 Giannisan
|
|
|
|
| 427 |
|
| 428 |
---
|
| 429 |
|
| 430 |
+
**Note**: This model is continuously being improved. Check back for updates and new versions!
|