Built with ❤️ by Matthew Davis - linkedin - github - Medium - Youtube - Facebook - Privy Filter Demo
Filtering photos for bias(racial, gender) for machine learning.
Privy Filter: Info and Demo Site
- Train Machine Learning Models minimizing unethical bias inherent in underlying photo dataset - IE Race, Gender, Age Discrimination
- Data Augmentation of Photo datasets to balance unethical data bias
- Create and Identify Unit Test Photos for datasets to ensure continual testing of bias in classification type problems
- Ethical Machine Learning - Remove Identity/Generalize Identinity/Generalize Race/Gender/Skincolor/Generalize
Privy filter is your photo dataset augmentor and analyzer for unethical bias(Race, Gender, Age)
v0.2 - Sythetic Face Generation and Face Swapping
- Face Detect - Needs improvement
- Face Scrub
- RemoveMetaData(imgPath)
- getRandomFakeFace : get Random Synthetic Face - done - needs tmp folder setting
- peopleObject - getFaceInfo - done - face model not loading on
- peopleObject - swapFace(img1, img2)
- processOne() - review demographics of current photo - suggest additional photos
- generatePhoto - from one photo and demographic info - generate those new photo demographic utilizing synthetic faces
- processDir() - process all the photos in the directory - first calculate the statistics and distributions - and parameterize a directory to save all sythetic balanced photos.
- Update DemoSite with Use Case direct notes and usability examples
- Detect skin - Dataset: http://cs-chan.com/downloads_skin_dataset.html
- AdjustSkin - Can adjust skincolor to generate new dataset photo
- Update processone stats and generatephoto to utilize skincolor data and manipulation
- Update demosite with video
- Demo of CelebA Dataset
- Test Face Aging Algo
- Test Gender Changing Algo
- Testing Race Direct Synthetic Style Transfer
- Fixes for DetectSkin and AdjustSkin
- Face pose matching for synthetic face replacement
- Review accuracy of underlying demographic model
- New CelebA Demo
- Support for multi face photo - Scoping - Document API updates
- Support for people but no face in photos - recognize poses without faces
- Back to baseline of usecase documentation
- Use Case Automated Testing
Scrub all identifying and data possible for bias from the dataset keeping a featureset that still allows for useful machine learning.
- Identify Features - Faces, People
- Remove Unethical Bias Data - New Synthetic Faces, Adjust Skin, Gender and Age Transformation
- Create alternatives synthetic photos for balanced training
- https://towardsdatascience.com/survey-d4f168791e57
- https://brie.berkeley.edu/sites/default/files/brie_wp_2018-3.pdf
- https://www.brookings.edu/research/algorithmic-bias-detection-and-mitigation-best-practices-and-policies-to-reduce-consumer-harms/
- https://healthitanalytics.com/news/eliminating-racial-bias-in-algorithm-development
What needs to be done for roadmap Contribution:
- Scoping
- Test Implementation for AI Model pieces - Colab Notebook of Models with Validation Data
- Library wrapping and Implementation
- Library Publish
Tasks:
- Face Detect - Colab Testing - Included in the Notebook folder in the repo.
- Facescrub - Colab Testing - Simplest De-identification - Simple blur - Commonly available
- Face Location Extraction
- Basic Library Object Implementation
- v0.1 Release for basic Direct Identifiers
- Pose Extraction Notebook
- Basic Skin Extraction
- Synthetic Face Generation
- Face Swap Testing
- Face Swap Integration into main library
- Fixes for model automated download
- Clean up API for people and privyfilter library to match specs.
- Replace Faces - Replace a face in a photo
- Scope out API for calculation and methodology of race/gender face demographic balancing
- Functions to process one photo for demographics and balanced demographics needed return
- Function generateSytheticPhoto - create the photo required
- Improved SkinExtraction Protocol
- Skin Adjustment Methodology
- Fixes for face detection to
- v0.2 Release for George Floyd Implementation
Use the package manager pip to install Privy - Privacy Photo Filter library.
pip install privyfilter
from privyfilter.privyfilter import Privyfilter as pf
faces2, img = pf.faceScrub("../TestPics/1Person-Close.jpg")
from privyfilter.privyfilter import Privyfilter as pf
img = pf.RemoveMetaData("../TestPics/1Person-Close.jpg")
swapimg = pf.swapFaces("../TestPics/1Person-Close.jpg", "../TestPics/2Person-Close.jpg")
cv2_imshow(swapimg)
- privyfilter.processDir(srcPath, dstPath) - analyze all photos for demographics in srcdirect, if dstdirect - generate the balanced dataset)
- privyfilter.processOne(srcPath, dstPath) - analyze photo and suggest demographics of balanced photo dataset - if dstpath then generate
- privyfilter.generatePhoto(srcPhoto, demographic, dstPath) - generate a photo from the original with the demographic params specified
- privyfilter.findFaces(imgpath, demographics=false) or privyfilter.findFaces(cv2 object) - returns array of faces and can include demographics.
- privyfilter.scrubFaces(imgPath) or privyfilter.scrubFaces(cv2 object) - returns faces, and scrubbed img
- privyfilter.swapFaces(img1Path, img2Path) or privyfilter.swapFaces(img1 cv2 object, img2 cv2 Object) - replaces all faces in 2nd image with first. Returns new image as cv2 Object.
- privyfilter.getFakeFace() - returns fakeface image object
- privyfilter.replaceFaces(img1) - returns img of all faces randomly replaced with fake ones.
python setup.py bdist_wheel --universal
twine upload dist/*
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update the tests as appropriate.