Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
title: MRI Orientation
|
| 3 |
emoji: 🐠
|
| 4 |
colorFrom: yellow
|
|
@@ -9,4 +10,87 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
|
| 3 |
title: MRI Orientation
|
| 4 |
emoji: 🐠
|
| 5 |
colorFrom: yellow
|
|
|
|
| 10 |
pinned: false
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# MRI Orientation Predictor
|
| 14 |
+
|
| 15 |
+
This is a simple web application for predicting the orientation of MRI images using a YOLOv11 classification model that is already pretrained on several MRI datasets.
|
| 16 |
+
It classifies images into **axial**, **coaxial**, or **sagittal** orientations and provides a confidence score.
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
## Features
|
| 21 |
+
|
| 22 |
+
* Predict MRI orientation for uploaded images.
|
| 23 |
+
* Display confidence score for the prediction.
|
| 24 |
+
* Easy-to-use web interface powered by **Gradio**.
|
| 25 |
+
* Supports `.jpg`, `.jpeg`, and `.png` images.
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## Model
|
| 30 |
+
|
| 31 |
+
The model is a **YOLOv11 classification model** saved as `best.pt`.
|
| 32 |
+
The model outputs short labels:
|
| 33 |
+
|
| 34 |
+
* `ax` → **axial**
|
| 35 |
+
* `co` → **coaxial**
|
| 36 |
+
* `sa` → **sagittal**
|
| 37 |
+
|
| 38 |
+
The application maps these short labels to full orientation names for easier understanding.
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## Installation
|
| 43 |
+
|
| 44 |
+
Install required packages:
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
pip install -r requirements.txt
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
### Requirements.txt
|
| 51 |
+
|
| 52 |
+
The `requirements.txt` should include at least:
|
| 53 |
+
|
| 54 |
+
```
|
| 55 |
+
ultralytics
|
| 56 |
+
torch
|
| 57 |
+
torchvision
|
| 58 |
+
gradio
|
| 59 |
+
Pillow
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Usage
|
| 65 |
+
|
| 66 |
+
1. Place your YOLOv11 model file `best.pt` in the project directory.
|
| 67 |
+
2. Run the Gradio app:
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
python app.py
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
3. Upload an MRI image in the interface.
|
| 74 |
+
4. The predicted orientation and confidence will be displayed.
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
## Example Output
|
| 79 |
+
|
| 80 |
+
```
|
| 81 |
+
Orientation: axial | Confidence: 0.95
|
| 82 |
+
Orientation: coaxial | Confidence: 0.87
|
| 83 |
+
Orientation: sagittal | Confidence: 0.92
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
+
## Notes
|
| 89 |
+
|
| 90 |
+
* Make sure your model is a YOLOv11 **classification model** saved as `.pt`.
|
| 91 |
+
* The model should return labels `"ax"`, `"co"`, `"sa"` which are mapped to full names.
|
| 92 |
+
* Confidence is reported as a float between 0 and 1.
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
|