AdhamQQ commited on
Commit
8ce1e4b
Β·
verified Β·
1 Parent(s): 28900a9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -33
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: StrokePatientsModel
3
- emoji: 🏒
4
- colorFrom: gray
5
- colorTo: gray
6
  sdk: streamlit
7
  sdk_version: 1.44.1
8
  app_file: app.py
@@ -10,56 +10,79 @@ pinned: false
10
  license: mit
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
14
 
 
15
 
 
16
 
17
- # 🧠 Stroke Pain Detection App
 
 
18
 
19
- A Streamlit-based app for automatically assessing pain intensity in stroke patients using facial asymmetry and deep learning.
20
 
21
- This project uses three steps:
22
- 1. **Detect the affected side** of a stroke patient's face using a Keras-based CNN model.
23
- 2. **Crop the unaffected half** of the face.
24
- 3. Use a PyTorch model to **predict the pain intensity (PSPI score)** from the expressive half.
 
 
 
 
25
 
26
  ---
27
 
28
- ## πŸš€ How to Use This App
 
 
 
 
 
 
 
 
29
 
30
- Simply upload a **full-face image** of a stroke patient and let the model:
31
- - Detect the affected side
32
- - Crop the unaffected side
33
- - Predict the patient's pain intensity (PSPI)
34
 
35
- βœ… You can access the live app here:
36
- [πŸ”— Launch App β†’](https://huggingface.co/spaces/AdhamQQ/StrokePatientsModel)
 
 
 
 
37
 
 
 
 
38
 
39
  ## πŸ’Ύ Models Used
40
 
41
- These models are automatically downloaded on first run:
 
 
 
 
 
 
 
42
 
43
- | Model | Description | Link |
44
- |----------------------------------|----------------------------------------|----------------------------------------------------------------------|
45
- | `cnn_stroke_model.keras` | Detects the affected side of the face | [Download](https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/cnn_stroke_model.keras) |
46
- | `right_side_pain_model.pth` | Predicts pain intensity (PSPI score) | [Download](https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/right_side_pain_model.pth) |
47
 
48
  ---
49
 
50
- ## 🧠 Project Goals
51
 
52
- This app is part of a larger system to:
53
- - Automatically detect which side of a stroke patient's face is impaired
54
- - Use the **expressive side** to analyze pain using PSPI (Prkachin and Solomon Pain Intensity) scores
55
 
56
  ---
57
 
58
- ## ✨ Credits
59
 
60
- using:
61
- - Streamlit
62
- - TensorFlow/Keras
63
- - PyTorch
64
- - Hugging Face Hub
65
 
 
1
  ---
2
+ title: StrokePainSideDetector
3
+ emoji: 🧠
4
+ colorFrom: red
5
+ colorTo: blue
6
  sdk: streamlit
7
  sdk_version: 1.44.1
8
  app_file: app.py
 
10
  license: mit
11
  ---
12
 
13
+ # 🧠 Stroke Patient Pain Intensity Detector
14
 
15
+ This app predicts the **pain intensity (PSPI score)** of stroke patients based on facial expressions using deep learning. It also detects the **affected side** of the face and uses the **unaffected half** for analysis.
16
 
17
+ ## πŸš€ What This App Does
18
 
19
+ 1. 🧠 **Detects affected side** of the face using a Keras CNN model.
20
+ 2. 🎯 **Crops the unaffected side** of the face using OpenCV + Haar cascades.
21
+ 3. πŸ“ˆ **Predicts pain score (PSPI)** using a PyTorch ResNet model.
22
 
23
+ If the face is tilted, the app will automatically rotate it for correct alignment before prediction.
24
 
25
+ ---
26
+
27
+ ## πŸ–ΌοΈ Input
28
+
29
+ Upload a **full-face photo** of a stroke patient. The app:
30
+ - Detects the face
31
+ - Splits the face in half (face point of view)
32
+ - Uses the expressive side for pain prediction
33
 
34
  ---
35
 
36
+ ## πŸ“Š Output
37
+
38
+ - **Affected Side** (face point of view)
39
+ - **Unaffected Side**
40
+ - **Predicted PSPI Score**: A number between 0 and 6
41
+ - **Raw pain model output**
42
+ - **Raw stroke model output** (value closer to 0 β†’ left side affected; closer to 1 β†’ right side affected)
43
+
44
+ ---
45
 
46
+ ## πŸ“š PSPI Score Scale
 
 
 
47
 
48
+ | Score | Pain Level |
49
+ |-------|-------------------|
50
+ | 0 | No pain |
51
+ | 1–2 | Mild pain |
52
+ | 3–4 | Moderate pain |
53
+ | 5–6 | Severe pain |
54
 
55
+ The PSPI (Prkachin and Solomon Pain Intensity) score is based on facial action units like eye tightening, brow lowering, and cheek raising.
56
+
57
+ ---
58
 
59
  ## πŸ’Ύ Models Used
60
 
61
+ | Model | Task | Format | Link |
62
+ |--------------------------|----------------------------------|----------------|----------------------------------------------------------------------|
63
+ | `cnn_stroke_model.keras` | Detect affected facial side | TensorFlow | [Download](https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/cnn_stroke_model.keras) |
64
+ | `pain_model.pth` | Predict PSPI pain intensity | PyTorch | [Download](https://huggingface.co/AdhamQQ/cnn_stroke_model/resolve/main/pain_model.pth) |
65
+
66
+ ---
67
+
68
+ ## πŸ› οΈ Technologies
69
 
70
+ - **Streamlit** for the web interface
71
+ - **OpenCV** for face detection
72
+ - **TensorFlow/Keras** for stroke side classification
73
+ - **PyTorch** for PSPI pain intensity prediction
74
 
75
  ---
76
 
77
+ ## 🀝 Credits
78
 
79
+ Developed by [Your Name or Team Name]
80
+ With support from Hugging Face Spaces
 
81
 
82
  ---
83
 
84
+ ## πŸ”— Live App
85
 
86
+ Launch it on Hugging Face Spaces:
87
+ [πŸ‘‰ Try It Now](https://huggingface.co/spaces/YourUsername/StrokePainSideDetector)
 
 
 
88