{"id":31758369,"url":"https://github.com/ishandutta0098/mukh","last_synced_at":"2025-10-09T20:24:56.002Z","repository":{"id":279460099,"uuid":"936811955","full_name":"ishandutta0098/mukh","owner":"ishandutta0098","description":"A comprehensive face analysis library that provides unified APIs for various face-related tasks","archived":false,"fork":false,"pushed_at":"2025-06-29T16:55:35.000Z","size":23829,"stargazers_count":324,"open_issues_count":6,"forks_count":70,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-09-23T13:21:13.741Z","etag":null,"topics":["ai","computer-vision","deepfake-detection","face-analysis","face-detection","face-reenactment","facial-landmarks","machine-learning","opencv","pip","python","torch"],"latest_commit_sha":null,"homepage":"https://ishandutta0098.github.io/mukh/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ishandutta0098.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATIONS.md","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-21T18:21:38.000Z","updated_at":"2025-09-21T17:55:57.000Z","dependencies_parsed_at":"2025-02-25T18:03:22.803Z","dependency_job_id":"63f6acd5-8e3f-4edb-b151-8a9922ed9f16","html_url":"https://github.com/ishandutta0098/mukh","commit_stats":null,"previous_names":["ishandutta0098/omniface","ishandutta0098/mukh"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ishandutta0098/mukh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishandutta0098%2Fmukh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishandutta0098%2Fmukh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishandutta0098%2Fmukh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishandutta0098%2Fmukh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ishandutta0098","download_url":"https://codeload.github.com/ishandutta0098/mukh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ishandutta0098%2Fmukh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002015,"owners_count":26083258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","computer-vision","deepfake-detection","face-analysis","face-detection","face-reenactment","facial-landmarks","machine-learning","opencv","pip","python","torch"],"created_at":"2025-10-09T20:24:51.339Z","updated_at":"2025-10-09T20:24:55.994Z","avatar_url":"https://github.com/ishandutta0098.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mukh\n\n\u003cdiv align=\"center\"\u003e\n\n[![Downloads](https://static.pepy.tech/personalized-badge/mukh?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=blue\u0026left_text=downloads)](https://pepy.tech/project/mukh)\n[![Documentation](https://img.shields.io/badge/docs-View%20Documentation-blue.svg?style=flat)](https://ishandutta0098.github.io/mukh/)\n[![Stars](https://img.shields.io/github/stars/ishandutta0098/mukh?color=yellow\u0026style=flat\u0026label=%E2%AD%90%20stars)](https://github.com/ishandutta0098/mukh/stargazers)\n[![License](https://img.shields.io/badge/license-Apache%202.0-green.svg?style=flat)](https://github.com/ishandutta0098/mukh/blob/master/LICENSE)\n[![PyPI](https://img.shields.io/badge/pypi-mukh-orange.svg?style=flat\u0026logo=pypi)](https://pypi.org/project/mukh/)\n\n[![LinkedIn](https://img.shields.io/badge/LinkedIn-@ishandutta0098-blue.svg?style=flat\u0026logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/in/ishandutta0098)\n[![Twitter](https://img.shields.io/:follow-@ishandutta0098-blue.svg?style=flat\u0026logo=x)](https://twitter.com/intent/user?screen_name=ishandutta0098)\n[![YouTube](https://img.shields.io/badge/YouTube-@ishandutta--ai-red?style=flat\u0026logo=youtube)](https://www.youtube.com/@ishandutta-ai)\n\n\u003c/div\u003e\n\nMukh (मुख, meaning \"face\" in Sanskrit) is a comprehensive face analysis library that provides unified APIs for various face-related tasks. It simplifies the process of working with multiple face analysis models through a consistent interface.\n\n## Features\n- 🥸 **DeepFake Detector:** First python package featuring an Ensemble of multiple models\n- 🎯 **Unified API**: Single, consistent API for multiple face analysis tasks like face detection and reenactment\n- 🔄 **Model Flexibility**: Support for multiple models per task\n- 🛠️ **Custom Pipelines**: Optimized preprocessing and model combinations\n  \n\n## Documentation\nThe library is documented in detail, [click here](https://ishandutta0098.github.io/mukh/) to view the documentation.\n  \n## Currently Supported Tasks\n\n- Face Detection\n- Face Reenactment with Source Image and Driving Video\n- Deepfake Detection for Image and Video\n- Deepfake Detection Pipeline - Ensemble of multiple models\n\n## Installation\n\n```bash\nconda create -n mukh-dev python=3.10 -y\nconda activate mukh-dev\npip install mukh==0.1.14\n```\n\n## Usage\n\n## Face Detection\n\n```python\nfrom mukh.face_detection import FaceDetector\n\n# Initialize detector\ndetection_model = \"mediapipe\"                                  # Other models: \"blazeface\", \"ultralight\"\ndetector = FaceDetector.create(detection_model)\n\n# Detect faces\ndetections = detector.detect(\n    image_path=\"assets/images/img1.jpg\",                       # Path to the image to detect faces in\n    save_json=True,                                             # Save the detections to a JSON file\n    json_path=f\"output/{detection_model}/detections.json\",       # Path to save the JSON file\n    save_annotated=True,                                       # Save the annotated image\n    output_folder=f\"output/{detection_model}\",                   # Path to save the annotated image\n)\n```\n  \n### Example\n```python \npython examples/face_detection/basic_detection_single_image.py --detection_model mediapipe\n```\n\n### Output Annotated Image\n\u003cimg src = \"https://github.com/user-attachments/assets/e2670b72-eb53-4cc1-ba5c-a3293ae23589\" width=200\u003e \n  \n```python\nimage_name | x1 |   y1  |  x2 |  y2 | confidence\n img1.jpg  | 62 |  228  | 453 | 619 | 0.9381868243217468\n```\n  \n## Face Reenactment\n\n```python\nfrom mukh.reenactment import FaceReenactor\n\n# Initialize reenactor\nreenactor_model = \"tps\"                           # Available models: \"tps\"\nreenactor = FaceReenactor.create(reenactor_model)\n\n# Reenact face\nresult_path = reenactor.reenact_from_video(\n    source_path=\"assets/images/img1.jpg\",         # Path to the source image\n    driving_video_path=\"assets/videos/video.mp4\", # Path to the driving video\n    output_path=f\"output/{reenactor_model}\",      # Path to save the reenacted video\n    save_comparison=True,                         # Save the comparison video\n    resize_to_image_resolution=False,             # Resize the reenacted video to the image resolution\n)\n```\n\n### Example\n```python\npython examples/reenactment/basic_reenactment.py \\\n  --reenactor_model tps \\\n  --source_path assets/images/img1.jpg \\\n  --driving_video_path assets/videos/video_1sec.mp4 \\\n  --output_folder output\n```\n\n### Output\n  \nhttps://github.com/user-attachments/assets/875ba692-ea78-42e3-9e03-d1f4703930be\n  \n## Deepfake Detection\n\n### Images\n\n```python\nimport torch\nfrom mukh.deepfake_detection import DeepfakeDetector\n\n# Initialize detector\ndetection_model = \"efficientnet\"                  # Other models \"resnet_inception\"\n\ndetector = DeepfakeDetector(\n    model_name=detection_model,\n    confidence_threshold=0.5,\n    device=torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\"),\n)\n\n# Detect deepfakes in Images\n\nmedia_path = \"assets/images/img1.jpg\"             \n\ndetections, final_result = detector.detect(\n    media_path=media_path,                                         # Path to the media file (image/video)\n    save_csv=True,                                                 # Save the detections to a CSV file\n    csv_path=f\"output/{detection_model}/deepfake_detections.csv\",  # Path to save the CSV file\n    save_annotated=True,                                           # Save the annotated media\n    output_folder=f\"output/{detection_model}\",                # Path to save the annotated media\n)\n```\n\n### Example\n```python\npython examples/deepfake_detection/detection.py \\\n  --detection_model resnet_inception \\\n  --media_path assets/images/img1.jpg \\\n  --confidence_threshold 0.5\n```  \n\n### Output\n```python\nmedia_name | frame_number | is_deepfake | confidence | model_name\nimg1.jpg   |      0       |      False  |    0.99    | efficientnet\n```\n\n  \n### Videos\n```python\nimport torch\nfrom mukh.deepfake_detection import DeepfakeDetector\n\n# Initialize detector\ndetection_model = \"efficientnet\"                  # Other models \"resnet_inception\"\n\ndetector = DeepfakeDetector(\n    model_name=detection_model,\n    confidence_threshold=0.5,\n    device=torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\"),\n)\n\n# Detect deepfakes in Videos\n\nmedia_path = \"assets/videos/deepfake_elon_musk.mp4\"             \n\ndetections, final_result = detector.detect(\n    media_path=media_path,                                         # Path to the media file (image/video)\n    save_csv=True,                                                 # Save the detections to a CSV file\n    csv_path=f\"output/{detection_model}/deepfake_detections.csv\",  # Path to save the CSV file\n    save_annotated=True,                                           # Save the annotated media\n    output_folder=f\"output/{detection_model}\",                # Path to save the annotated media\n    num_frames=11,                                                 # Number of equally spaced frames for video analysis\n)\n\n```\n\n### Example\n```python\npython examples/deepfake_detection/detection.py \\\n  --detection_model resnet_inception \\\n  --media_path assets/videos/deepfake_elon_musk.mp4 \\\n  --confidence_threshold 0.5 \\\n  --num_frames 11\n```\n\n### Output\n```python\n      media_name       | frame_number |is_deepfake|confidence|      model_name\ndeepfake_elon_musk.mp4 |      0       |    True  |    0.99   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |      43      |    True  |    0.69   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |      86      |    False |    0.73   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     172      |    True  |    0.95   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     215      |    True  |    0.98   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     129      |    True  |    0.96   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     258      |    True  |    0.53   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     301      |    True  |    0.77   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     344      |    False |    0.83   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     387      |    True  |    0.62   |EfficientNetAutoAttB4\ndeepfake_elon_musk.mp4 |     431      |    False |    0.79   |EfficientNetAutoAttB4\n```\n```python\n| deepfake_elon_musk.mp4 | EfficientNetAutoAttB4 | 8/11 deepfake frames | Final: DEEPFAKE\n```\n  \n## Deepfake Detection Pipeline\n  \n```python\nfrom mukh.pipelines.deepfake_detection import PipelineDeepfakeDetection\n\n# Define model configurations with weights\nmodel_configs = {\n    \"resnet_inception\": 0.5,\n    \"efficientnet\": 0.5\n}\n\n# Create ensemble detector\npipeline = PipelineDeepfakeDetection(model_configs)\n\nmedia_path = \"assets/videos/deepfake_elon_musk.mp4\" # Or pass an image path\n\n# Detect deepfakes\nresult = pipeline.detect(\n    media_path=media_path,\n    output_folder=\"output/deepfake_detection_pipeline\",\n    save_csv=True,\n    num_frames=11,        # Number of equally spaced video frames for analysis\n)\n```\n\n### Example\n```python\npython examples/pipelines/deepfake_detection.py \\\n  --media_path assets/videos/deepfake_elon_musk.mp4 \\\n  --output_folder output/deepfake_detection_pipeline\n```\n\n### Output\n**Ensemble confidence score**\n```python\nframe_number|is_deepfake|confidence\n     0      |   True    |   0.5\n    43      |   True    |   0.84\n    86      |   True    |   0.635\n   129      |   True    |   0.98\n   172      |   True    |   0.975\n   215      |   True    |   0.99\n   258      |   True    |   0.765\n   301      |   True    |   0.885\n   344      |   True    |   0.585\n   387      |   True    |   0.81\n   431      |   True    |   0.605\n```\n\n**Result from the respective models**\n```python\n | deepfake_elon_musk.mp4 |   ResNetInception     | 10/11 deepfake frames | Final: DEEPFAKE\n | deepfake_elon_musk.mp4 | EfficientNetAutoAttB4 |  8/11 deepfake frames | Final: DEEPFAKE\n```\n\n**Final Pipeline Output**\n```python\nFinal Ensemble Result: DEEPFAKE\nDeepfake frames: 11/11\nAverage confidence: 0.7791\nModel configurations: {\n  'resnet_inception': 0.5,\n  'efficientnet': 0.5\n}\n```\n  \n## Citations\nFor a detailed list of models, libraries, and datasets used, please refer to [CITATIONS.md](CITATIONS.md).\n  \n## Contact\nFor questions and feedback, please open an issue on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishandutta0098%2Fmukh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fishandutta0098%2Fmukh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishandutta0098%2Fmukh/lists"}