MRI_orientation / README.md
shimaa22's picture
Update README.md
992c9a6 verified
---
title: MRI Orientation
emoji: 🐠
colorFrom: yellow
colorTo: gray
sdk: gradio
sdk_version: 6.2.0
app_file: app.py
pinned: false
---
# MRI Orientation Predictor
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.
It classifies images into **axial**, **coaxial**, or **sagittal** orientations and provides a confidence score.
---
## Features
* Predict MRI orientation for uploaded images.
* Display confidence score for the prediction.
* Easy-to-use web interface powered by **Gradio**.
* Supports `.jpg`, `.jpeg`, and `.png` images.
---
## Model
The model is a **YOLOv11 classification model** saved as `best.pt`.
The model outputs short labels:
* `ax` β†’ **axial**
* `co` β†’ **coaxial**
* `sa` β†’ **sagittal**
The application maps these short labels to full orientation names for easier understanding.
---
## Installation
Install required packages:
```bash
pip install -r requirements.txt
```
### Requirements.txt
The `requirements.txt` should include at least:
```
ultralytics
torch
torchvision
gradio
Pillow
```
---
## Usage
1. Place your YOLOv11 model file `best.pt` in the project directory.
2. Run the Gradio app:
```bash
python app.py
```
3. Upload an MRI image in the interface.
4. The predicted orientation and confidence will be displayed.
---
## Example Output
```
Orientation: axial | Confidence: 0.95
Orientation: coaxial | Confidence: 0.87
Orientation: sagittal | Confidence: 0.92
```
---
## Notes
* Make sure your model is a YOLOv11 **classification model** saved as `.pt`.
* The model should return labels `"ax"`, `"co"`, `"sa"` which are mapped to full names.
* Confidence is reported as a float between 0 and 1.
---