Instructions to use haresh2792005/MFAF-Net with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MediaPipe
How to use haresh2792005/MFAF-Net with MediaPipe:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download mfaf_net/model_comparison.py from haresh2792005/MFAF-Net: direct link, hf CLI and curl.
- Browser
- Download file 4.19 kB
-
https://huggingface.co/haresh2792005/MFAF-Net/resolve/main/mfaf_net/model_comparison.py
- Command line
-
hf download hf://haresh2792005/MFAF-Net/mfaf_net/model_comparison.py
-
curl -L -o model_comparison.py https://huggingface.co/haresh2792005/MFAF-Net/resolve/main/mfaf_net/model_comparison.py
4.19 kB
| """ | |
| MFAF-Net vs LandmarkDiff Comparison Data. | |
| Provides a structured comparison between our MFAF-Net approach and the | |
| existing LandmarkDiff baseline (HuggingFace: dreamlessx/LandmarkDiff). | |
| Used in both the Flask UI and research paper generation. | |
| """ | |
| LANDMARKDIFF_INFO = { | |
| 'name': 'LandmarkDiff', | |
| 'source': 'dreamlessx/LandmarkDiff (HuggingFace)', | |
| 'pipeline_stages': [ | |
| 'MediaPipe 478-point 3D face mesh extraction', | |
| 'Gaussian RBF deformations calibrated from anthropometric surgical datasets', | |
| 'Wireframe rendering of deformed mesh', | |
| 'ControlNet-conditioned Stable Diffusion 1.5 for realistic texture generation', | |
| 'Laplacian pyramid blending + neural face restoration + identity verification', | |
| ], | |
| 'supported_procedures': [ | |
| {'id': 'rhinoplasty', 'landmarks': 24, 'rbf_sigma_px': 30}, | |
| {'id': 'blepharoplasty', 'landmarks': 28, 'rbf_sigma_px': 15}, | |
| {'id': 'rhytidectomy', 'landmarks': None, 'rbf_sigma_px': None}, | |
| {'id': 'orthognathic', 'landmarks': None, 'rbf_sigma_px': None}, | |
| {'id': 'brow_lift', 'landmarks': None, 'rbf_sigma_px': None}, | |
| {'id': 'mentoplasty', 'landmarks': None, 'rbf_sigma_px': None}, | |
| ], | |
| } | |
| MFAF_NET_INFO = { | |
| 'name': 'MFAF-Net (Ours)', | |
| 'full_name': 'Multimodal Facial Analysis and Feature-guided Network', | |
| 'pipeline_stages': [ | |
| 'Module 1: MediaPipe 468-point FaceMesh landmark extraction + region measurements', | |
| 'Module 2: Patient metadata encoding (age, sex, Fitzpatrick skin type, treatment history)', | |
| 'Module 3: Procedure-aware multimodal feature fusion with attention weighting', | |
| 'Module 4: Procedural piecewise affine warping (Delaunay triangulation, no GPU needed)', | |
| 'Module 5: Quantitative comparison (SSIM, PSNR, MAE, changed-pixel %)', | |
| ], | |
| 'supported_procedures': [ | |
| 'rhinoplasty', 'blepharoplasty', 'rhytidectomy', | |
| 'genioplasty', 'forehead_surgery', 'brow_lift', | |
| ], | |
| } | |
| COMPARISON_TABLE = [ | |
| { | |
| 'feature': 'Input modality', | |
| 'landmarkdiff': 'Image only', | |
| 'mfaf_net': 'Image + patient metadata (multimodal)', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Landmark model', | |
| 'landmarkdiff': '478-point 3D mesh', | |
| 'mfaf_net': '468-point FaceMesh + patient-guided fusion', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Patient context', | |
| 'landmarkdiff': 'None', | |
| 'mfaf_net': 'Age, sex, Fitzpatrick skin type, treatment history', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Deformation method', | |
| 'landmarkdiff': 'Gaussian RBF', | |
| 'mfaf_net': 'Procedure-aware piecewise affine + patient-guided attention', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Output', | |
| 'landmarkdiff': 'Simulated image only', | |
| 'mfaf_net': 'Image + difference heatmap + quantitative metrics', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Evaluation metrics', | |
| 'landmarkdiff': 'Qualitative', | |
| 'mfaf_net': 'SSIM, PSNR, MAE, changed-pixel %', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Hardware requirement', | |
| 'landmarkdiff': 'GPU (Stable Diffusion)', | |
| 'mfaf_net': 'CPU only', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Deployment', | |
| 'landmarkdiff': 'Requires Docker / GPU server', | |
| 'mfaf_net': 'Standard Flask server, runs anywhere', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Model size', | |
| 'landmarkdiff': 'Multi-GB (SD 1.5 + ControlNet)', | |
| 'mfaf_net': 'Lightweight (MediaPipe only, ~20 MB)', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| { | |
| 'feature': 'Inference speed', | |
| 'landmarkdiff': 'Slow (diffusion sampling)', | |
| 'mfaf_net': 'Fast (geometric transforms, seconds)', | |
| 'advantage': 'mfaf_net', | |
| }, | |
| ] | |
| def get_comparison_dict() -> dict: | |
| """Return full comparison data as a serialisable dict.""" | |
| return { | |
| 'baseline': LANDMARKDIFF_INFO, | |
| 'proposed': MFAF_NET_INFO, | |
| 'comparison_table': COMPARISON_TABLE, | |
| } | |