Feature/face anonymization#166
Open
Mah-diaa wants to merge 43 commits into
Open
Conversation
Feature/auto nasion detection
…-10 comparison - Strip validator.py to practical sanity check (face removed, mesh valid, protected points intact) - Remove fake metrics that just confirmed a==a (curvature, non-facial displacement, landmark deviation) - Add notebook 52: end-to-end validation comparing 10-10 system on original vs anonymized - Update __init__.py, ui.py, and tests to use new ValidationResult API
Added validation notebook!
Implements automatic and semi-manual face removal for GDPR-compliant anonymization of 3D photogrammetry scans: - MediaPipe-based nasion detection with manual click fallback - Geometric landmark estimation (Iz, Cz, LPA, RPA) from nasion - Face mask via spherical projection of MediaPipe face contour - Interactive refinement with click-to-delete circles - Vertex deletion preserving all landmarks and optodes
Refinement step now supports: - T key to toggle between add and remove mode - +/- keys to adjust brush radius (5-100mm) - Color-coded feedback (yellow=add, cyan=remove) - Status text updates live with mode and radius
Move controls text to lower-right, increase font size to 14, set color to black for better visibility. Add detailed keyboard shortcut instructions in the markdown cell. Clear all cell outputs.
…_nasion and get_facial_region_mask_from_nasion
…ndmarks TSV export
# Conflicts: # environment_dev.yml # examples/head_models/43_crs_and_headmodel.ipynb
…n suite to validation/face-anonymization
…on-pipeline branch)
…ared utils, remove dead parameters and never-firing guards
…s and headline results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This work was developed as part of my thesis on facial anonymization for photogrammetry scans. I tried to abide as much as possible by the rules of contribution in the wiki. I will also attempt to explain how the more "vague" parts of this works. Hope this helps!
Summary
This PR adds a deletion-based face anonymization pipeline for photogrammetry scans used in fNIRS workflows. The pipeline takes a surface plus five anatomical landmarks (
Nz,Iz,Cz,LPA,RPA), isolates the head from surrounding scan artifacts/body geometry, removes the facial/ear region while preserving landmarks and cap-relevant geometry, and exports an anonymized OBJ bundle.What changed
cedalion.geometry.photogrammetry.anonymizationanonymize_scan(...)as the main public entry pointdeletion, frame reversion, and anonymized OBJ export
examples/head_models/51_manual_5pt_anonymization.ipynbfor the manual 5-landmark workflowtests/test_anonymization.pyDesign notes
Nz,Iz,Cz,LPA, andRPA.digitizedframe by default. I did this because I was unsure whether downstream cedalion workflows require the anonymized surface to keep the same frame convention as the original scan.anonymize_scan(...), so the deletion region can be made more conservative or more aggressive if the default mask is too generous or too greedy for a given scan.Validation
Added synthetic mesh tests covering the exported API and the end-to-end anonymization path:
Example Jupyter notebook
The example workflow is in:
examples/head_models/51_manual_5pt_anonymization.ipynbIt demonstrates the intended manual 5-landmark workflow:
Nz,Iz,Cz,LPA, andRPAanonymize_scan(surface, landmarks)save_anonymized_scan(...)Before running it, update the local input/output paths near the top of the notebook:
SCANS_FOLDER: folder containing the subject scan foldersSUBJECT_ID: subject folder or scan identifier to processOUT_DIR: destination folder for the anonymized OBJ/MTL/JPG outputReviewer notes
src/cedalion/geometry/photogrammetry/anonymization/.