Skip to content

insyirahazman/AlphaPose-for-PD-Detection

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AlphaPose for Parkinson's Disease Detection

This repository is an enhanced version of AlphaPose specifically adapted for Parkinson's Disease (PD) detection and analysis. It has been optimized to run on CPU-only machines and includes advanced batch processing capabilities for analyzing multiple patient videos efficiently.

πŸ’‘ Overview

AlphaPose is a state-of-the-art multi-person pose estimator. This specialized version has been tailored for:

  • Parkinson's Disease research and clinical analysis
  • CPU-only environments (no GPU required)
  • Batch processing of multiple patient videos
  • Gait analysis and movement pattern detection
  • Clinical research applications

πŸ› οΈ Key Features

  • βœ… Multi-person pose estimation optimized for medical analysis
  • βœ… CPU-only processing - no GPU dependencies
  • βœ… Batch video processing with progress tracking and resume functionality
  • βœ… Configuration-driven processing with customizable parameters
  • βœ… Individual patient folders for organized output
  • βœ… JSON pose data export for further analysis
  • βœ… Processing status tracking (complete/incomplete/missing)
  • βœ… Memory optimization for large video datasets
  • βœ… Output JSON filename matches video name (e.g., test_3.json)
  • ⚠️ Slower inference compared to GPU-based processing

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/insyirahazman/AlphaPose-for-PD-Detection.git
cd AlphaPose-for-PD-Detection

2. Install Dependencies

# Install PyTorch CPU version
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

# Install other requirements
pip install -r requirements.txt

3. Basic Usage

Single Video Processing

python video_demo.py --video input_video.mp4 --outdir output_folder --cpu
  • Output: Results are saved in a folder named after the video (e.g., output_folder/test_3/). The pose data is exported as test_3.json.

Batch Processing (Recommended for PD Analysis)

python batch_video_demo.py --input_dir "path/to/patient/videos" --output_dir "path/to/results" --cpu --vis_fast
  • Output: Each video gets its own folder, and the pose data is saved as {video_name}.json (e.g., test_3.json).

πŸ“ Project Structure

AlphaPose-for-PD-Detection/
β”œβ”€β”€ batch_video_demo.py          # Enhanced batch processing script
β”œβ”€β”€ batch_config.ini             # Configuration file for batch processing
β”œβ”€β”€ run_batch_video.bat          # Windows batch script
β”œβ”€β”€ run_batch_video.ps1          # PowerShell script
β”œβ”€β”€ video_demo.py                # Single video processing script
β”œβ”€β”€ demo.py                      # Image processing demo
β”œβ”€β”€ BATCH_README.md              # Detailed batch processing documentation
β”œβ”€β”€ README.md                    # This file
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ models/                      # Pre-trained models
β”œβ”€β”€ examples/                    # Example images and videos
β”œβ”€β”€ SPPE/                        # Single Person Pose Estimation module
β”œβ”€β”€ yolo/                        # YOLO detection module
└── outputs/                     # Processing results

🎯 For Parkinson's Disease Research

Typical Workflow

  1. Collect patient videos (walking, movement tasks)
  2. Organize videos by patient ID and condition
  3. Configure batch processing parameters
  4. Run batch analysis on all videos
  5. Extract pose data for gait analysis
  6. Analyze movement patterns for PD indicators

Configuration for PD Analysis

[DETECTION]
MODE = fast                         # Fast processing for clinical use
CONFIDENCE = 0.05                   # Lower threshold for medical analysis
NMS_THRESHOLD = 0.6

[OUTPUT]
SAVE_VIDEO = True                   # Keep videos for clinical review
FAST_VISUALIZATION = True           # Optimize for speed
SAVE_IMAGES = False                 # Save space for large datasets

[PROCESSING]
USE_CPU = True                      # CPU-only for compatibility
RESUME = True                       # Resume interrupted processing
VIDEO_EXTENSIONS = mp4,avi,mov      # Common medical video formats

πŸ”§ Advanced Usage

Command Line Options

# Dry run to check what will be processed
python batch_video_demo.py --dry_run

# Process specific directory with custom output
python batch_video_demo.py -i "PD_videos/front" -o "results/front_analysis"

# Enable profiling for performance analysis
python batch_video_demo.py --profile --cpu

# Use custom configuration file
python batch_video_demo.py --config "pd_config.ini"

Batch Processing Features

  • Resume capability: Skip already processed videos
  • Progress tracking: Real-time progress bars and status updates
  • Error handling: Continue processing after failures
  • Memory management: Optimized for large video datasets
  • Status checking: Track complete/incomplete/missing results

πŸ“Š Output Data Format

JSON Pose Data Structure

{
  "version": "1.3",
  "people": [
    {
      "pose_keypoints_2d": [
        x1, y1, confidence1,    # Nose
        x2, y2, confidence2,    # Left Eye
        x3, y3, confidence3,    # Right Eye
        ...                     # 17 keypoints total
      ],
      "face_keypoints_2d": [...],
      "hand_left_keypoints_2d": [...],
      "hand_right_keypoints_2d": [...]
    }
  ]
}

Keypoint Indices (COCO Format)

  • 0: Nose, 1: Left Eye, 2: Right Eye
  • 3: Left Ear, 4: Right Ear
  • 5: Left Shoulder, 6: Right Shoulder
  • 7: Left Elbow, 8: Right Elbow
  • 9: Left Wrist, 10: Right Wrist
  • 11: Left Hip, 12: Right Hip
  • 13: Left Knee, 14: Right Knee
  • 15: Left Ankle, 16: Right Ankle

πŸ“š Documentation

  • BATCH_README.md - Comprehensive batch processing guide
  • examples/ - Sample videos and expected outputs
  • doc/ - Additional documentation and guides

⚑ Performance Tips

For Large Datasets

  • Use --vis_fast for faster processing
  • Set DETECTION_BATCH_SIZE = 1 for memory efficiency
  • Enable RESUME = True for interrupted processing
  • Process videos in smaller batches if memory limited

For Clinical Use

  • Use MODE = fast for real-time analysis
  • Set CONFIDENCE = 0.05 for sensitive detection
  • Enable SAVE_VIDEO = True for clinical review
  • Organize videos by patient ID and session

🀝 Contributors

Original AlphaPose Development:

πŸ“– References

Technical References

  1. Original AlphaPose Repository
  2. AlphaPose PyTorch Implementation
  3. Windows Installation Guide
  4. Real-time Pose Estimation Tutorial

Medical/Clinical References

  1. Gait Analysis in Parkinson's Disease
  2. Computer Vision in Medical Diagnosis
  3. Pose Estimation for Healthcare

πŸ”¬ Research Citation

Original AlphaPose Citation:

@inproceedings{fang2017rmpe,
  title={{RMPE}: Regional Multi-person Pose Estimation},
  author={Fang, Hao-Shu and Xie, Shuqin and Tai, Yu-Wing and Lu, Cewu},
  booktitle={ICCV},
  year={2017}
}

@article{li2018crowdpose,
  title={CrowdPose: Efficient Crowded Scenes Pose Estimation and A New Benchmark},
  author={Li, Jiefeng and Wang, Can and Zhu, Hao and Mao, Yihuan and Fang, Hao-Shu and Lu, Cewu},
  journal={arXiv preprint arXiv:1812.00324},
  year={2018}
}

@inproceedings{xiu2018poseflow,
  author = {Xiu, Yuliang and Li, Jiefeng and Wang, Haoyu and Fang, Yinghong and Lu, Cewu},
  title = {{Pose Flow}: Efficient Online Pose Tracking},
  booktitle={BMVC},
  year = {2018}
}

πŸ“„ License

This project maintains the same license as the original AlphaPose project. Please refer to the original repository for license details.


πŸ†˜ Support & Issues


⭐ Star this repository if it helps your research!

About

Real-Time and Accurate Full-Body Multi-Person Pose Estimation&Tracking System

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 77.3%
  • C++ 10.7%
  • C 7.1%
  • Cuda 3.9%
  • SWIG 0.3%
  • Cython 0.2%
  • Other 0.5%