Giter Site home page Giter Site logo

deamoner / privyfilter Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 72.7 MB

Privy filter is made to give the method for removing/accommodating for unethical bias in data.

Home Page: https://privyfilter.herokuapp.com/

License: MIT License

Jupyter Notebook 94.10% Python 5.90%
privacy photo-privacy direct-identifiers racism deidentify machine-learning bias

privyfilter's Introduction

Photo Filter for racial/ethical bias

Filtering photos for bias(racial, gender) for machine learning.

Privy filter is your photo dataset augmentor and analyzer for unethical bias(Race, Gender, Age)

Filtering photos for bias(racial, gender) for machine learning.

Demo

Privy Filter: Info and Demo Site

Use Cases

  • 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)

privyfilter detect and blurr faces privyfilter detect and blurr faces

Latest Release:

v0.2 - Sythetic Face Generation and Face Swapping

Roadmap

v0.1 - Basic Direct Identifier Scrubbing - Done

  • Face Detect - Needs improvement
  • Face Scrub

v0.1.6 - Basic Meta Data Scrubber - Done

  • RemoveMetaData(imgPath)

v0.2.0 - Identify face and replace - Done

  • getRandomFakeFace : get Random Synthetic Face - done - needs tmp folder setting
  • peopleObject - getFaceInfo - done - face model not loading on
  • peopleObject - swapFace(img1, img2)

v0.3.0 - ProcessAll and Use Case Direct Finishing

  • 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

v0.4.0 - Identify other identifiers and bias features

  • 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

v0.5 - Direct Aging and Gender

  • Test Face Aging Algo
  • Test Gender Changing Algo
  • Testing Race Direct Synthetic Style Transfer
  • Fixes for DetectSkin and AdjustSkin

v0.6 - Improve/Increase Original Photoset data quality retention through improve synthetic matching

  • Face pose matching for synthetic face replacement
  • Review accuracy of underlying demographic model
  • New CelebA Demo

v0.7 - Increase compatibility of pipeline for photosets

  • Support for multi face photo - Scoping - Document API updates
  • Support for people but no face in photos - recognize poses without faces

v0.8 - Reliability Fixes

  • Back to baseline of usecase documentation
  • Use Case Automated Testing

Methodology

Scrub all identifying and data possible for bias from the dataset keeping a featureset that still allows for useful machine learning.

  1. Identify Features - Faces, People
  2. Remove Unethical Bias Data - New Synthetic Faces, Adjust Skin, Gender and Age Transformation
  3. Create alternatives synthetic photos for balanced training

References Work

Process for Features

What needs to be done for roadmap Contribution:

  1. Scoping
  2. Test Implementation for AI Model pieces - Colab Notebook of Models with Validation Data
  3. Library wrapping and Implementation
  4. 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

Installation

Use the package manager pip to install Privy - Privacy Photo Filter library.

pip install privyfilter

Basic Usage

from privyfilter.privyfilter import Privyfilter as pf

faces2, img = pf.faceScrub("../TestPics/1Person-Close.jpg")

Scrub Meta Data

from privyfilter.privyfilter import Privyfilter as pf
img = pf.RemoveMetaData("../TestPics/1Person-Close.jpg")

Face Swap - Inputs imgPath

swapimg = pf.swapFaces("../TestPics/1Person-Close.jpg", "../TestPics/2Person-Close.jpg")
cv2_imshow(swapimg)

EndGoal API:

  • 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.

Deploying Module

python setup.py bdist_wheel --universal
twine upload dist/*

Contributing

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.

License

MIT

privyfilter's People

Contributors

deamoner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kumar-deep-dhar

privyfilter's Issues

Fix save location for synthetic face retrieval

Right now the files write to the script location path and cause issue in the repo.

  • Write file location to temp location that gets cleared
  • Ignore file writes on the repo for the examples folder for images to solve repo issues.

MVP Launch Items

  1. Slack or Discord Channel
  2. setup sponsor on github
  3. setup patreon
  4. demo video and gif
  5. demo article

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.