tinyface


Nametinyface JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://del.wang
SummaryThe minimalist face swapping tool that just works.
upload_time2024-11-10 03:17:26
maintainerDel Wang
docs_urlNone
authorDel Wang
requires_python<4.0,>=3.10
licenseMIT
keywords ai face swap facefusion insightface
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TinyFace

<a href="https://pypi.python.org/pypi/tinyface"><img src="http://img.shields.io/pypi/v/tinyface.svg" alt="Latest version on PyPI"></a> <a href="https://pypi.python.org/pypi/tinyface"><img src="https://img.shields.io/pypi/pyversions/tinyface.svg" alt="Compatible Python versions."></a>

TinyFace is designed as a lightweight Python library with a simplified command-line interface, making it easy for both developers and users to perform face swaps.

## Features

- **Minimalist design**: Focuses solely on face swapping with optimized speed and minimal dependencies.
- **Easy-to-use API**: Integrate face swapping into your own projects with just a few lines of code.
- **Single and multi-face support**: Swap a single face or multiple faces in one go.
- **Command-line tool**: Easily perform face swaps directly from the terminal.

## Installation

Install `tinyface` with pip:

```bash
pip install tinyface
```

## Usage

```python
import cv2

from tinyface import FacePair, TinyFace

# Load input images
input_img = cv2.imread("input.jpg")
reference_img = cv2.imread("reference.jpg")
destination_img = cv2.imread("destination.jpg")

# Initialize the TinyFace instance
tinyface = TinyFace()

# (Optional) Prepare models (downloads automatically if skipped)
tinyface.prepare()

# Detect faces in the images
faces = tinyface.get_many_faces(input_img)
reference_face = tinyface.get_one_face(reference_img)
destination_face = tinyface.get_one_face(destination_img)

# Swap a single face
output_img = tinyface.swap_face(input_img, reference_face, destination_face)

# Swap multiple faces
output_img = tinyface.swap_faces(
    input_img,
    face_pairs=[FacePair(reference=reference_face, destination=destination_face)],
)
cv2.imwrite("out.jpg", output_img)
```

## Commands

```bash
usage: tinyface swap [-h] -i INPUT -r REFERENCE -d DESTINATION [-s SAVE] [-w WORKERS]

options:
  -h, --help            Show this help message and exit
  -i INPUT, --input INPUT
                        Path to the input image(s)
  -r REFERENCE, --reference REFERENCE
                        Path to the reference face image(s)
  -d DESTINATION, --destination DESTINATION
                        Path to the destination face image(s)
  -s SAVE, --save SAVE  Save path for output image(s)
  -w WORKERS, --workers WORKERS
                        Number of worker threads for parallel processing
```

## Disclaimer

This software is intended to contribute positively to the AI-generated media field, helping artists with tasks like character animation and clothing model creation.

Please use responsibly. If working with real faces, always obtain consent and label deepfakes clearly when sharing. The developers are not responsible for any misuse or legal consequences.

## Credits

This project is built upon [@henryruhs](https://github.com/henryruhs)'s work on [facefusion](https://github.com/facefusion/facefusion). TinyFace retains only the minimal dependencies required for face swapping, optimizing both speed and size.

## License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.

> **Note:** TinyFace relies on third-party pre-trained models, each with their own licenses and terms.
            

Raw data

            {
    "_id": null,
    "home_page": "https://del.wang",
    "name": "tinyface",
    "maintainer": "Del Wang",
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": "hello@xbox.work",
    "keywords": "ai, face swap, facefusion, insightface",
    "author": "Del Wang",
    "author_email": "hello@xbox.work",
    "download_url": "https://files.pythonhosted.org/packages/cb/9a/413bc4d00b450b90bfa7ac6ebba972d47bacaf6a39284f852b3d7fe78eb7/tinyface-1.0.1.tar.gz",
    "platform": null,
    "description": "# TinyFace\n\n<a href=\"https://pypi.python.org/pypi/tinyface\"><img src=\"http://img.shields.io/pypi/v/tinyface.svg\" alt=\"Latest version on PyPI\"></a> <a href=\"https://pypi.python.org/pypi/tinyface\"><img src=\"https://img.shields.io/pypi/pyversions/tinyface.svg\" alt=\"Compatible Python versions.\"></a>\n\nTinyFace is designed as a lightweight Python library with a simplified command-line interface, making it easy for both developers and users to perform face swaps.\n\n## Features\n\n- **Minimalist design**: Focuses solely on face swapping with optimized speed and minimal dependencies.\n- **Easy-to-use API**: Integrate face swapping into your own projects with just a few lines of code.\n- **Single and multi-face support**: Swap a single face or multiple faces in one go.\n- **Command-line tool**: Easily perform face swaps directly from the terminal.\n\n## Installation\n\nInstall `tinyface` with pip:\n\n```bash\npip install tinyface\n```\n\n## Usage\n\n```python\nimport cv2\n\nfrom tinyface import FacePair, TinyFace\n\n# Load input images\ninput_img = cv2.imread(\"input.jpg\")\nreference_img = cv2.imread(\"reference.jpg\")\ndestination_img = cv2.imread(\"destination.jpg\")\n\n# Initialize the TinyFace instance\ntinyface = TinyFace()\n\n# (Optional) Prepare models (downloads automatically if skipped)\ntinyface.prepare()\n\n# Detect faces in the images\nfaces = tinyface.get_many_faces(input_img)\nreference_face = tinyface.get_one_face(reference_img)\ndestination_face = tinyface.get_one_face(destination_img)\n\n# Swap a single face\noutput_img = tinyface.swap_face(input_img, reference_face, destination_face)\n\n# Swap multiple faces\noutput_img = tinyface.swap_faces(\n    input_img,\n    face_pairs=[FacePair(reference=reference_face, destination=destination_face)],\n)\ncv2.imwrite(\"out.jpg\", output_img)\n```\n\n## Commands\n\n```bash\nusage: tinyface swap [-h] -i INPUT -r REFERENCE -d DESTINATION [-s SAVE] [-w WORKERS]\n\noptions:\n  -h, --help            Show this help message and exit\n  -i INPUT, --input INPUT\n                        Path to the input image(s)\n  -r REFERENCE, --reference REFERENCE\n                        Path to the reference face image(s)\n  -d DESTINATION, --destination DESTINATION\n                        Path to the destination face image(s)\n  -s SAVE, --save SAVE  Save path for output image(s)\n  -w WORKERS, --workers WORKERS\n                        Number of worker threads for parallel processing\n```\n\n## Disclaimer\n\nThis software is intended to contribute positively to the AI-generated media field, helping artists with tasks like character animation and clothing model creation.\n\nPlease use responsibly. If working with real faces, always obtain consent and label deepfakes clearly when sharing. The developers are not responsible for any misuse or legal consequences.\n\n## Credits\n\nThis project is built upon [@henryruhs](https://github.com/henryruhs)'s work on [facefusion](https://github.com/facefusion/facefusion). TinyFace retains only the minimal dependencies required for face swapping, optimizing both speed and size.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.\n\n> **Note:** TinyFace relies on third-party pre-trained models, each with their own licenses and terms.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The minimalist face swapping tool that just works.",
    "version": "1.0.1",
    "project_urls": {
        "Changelog": "https://github.com/idootop/TinyFace/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/idootop/TinyFace/README.md",
        "Homepage": "https://del.wang",
        "Repository": "https://github.com/idootop/TinyFace"
    },
    "split_keywords": [
        "ai",
        " face swap",
        " facefusion",
        " insightface"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "226cc6526fc1afeadd51dd17eec82fd4934a0dfc59224d61f89bc7f18604759d",
                "md5": "9ae994b33adca0837fa034007ebe2f28",
                "sha256": "4cc4e3b75feee743843b0dfc9c60d276443d153c809c9720790be33ed950ab15"
            },
            "downloads": -1,
            "filename": "tinyface-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ae994b33adca0837fa034007ebe2f28",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 17945,
            "upload_time": "2024-11-10T03:17:23",
            "upload_time_iso_8601": "2024-11-10T03:17:23.752346Z",
            "url": "https://files.pythonhosted.org/packages/22/6c/c6526fc1afeadd51dd17eec82fd4934a0dfc59224d61f89bc7f18604759d/tinyface-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb9a413bc4d00b450b90bfa7ac6ebba972d47bacaf6a39284f852b3d7fe78eb7",
                "md5": "15458685224e2a067bc0bf15bf0abd32",
                "sha256": "243e4dc020d941030da9621ba90ab0334cbb18f00b4f376e25e01a1c4bed743b"
            },
            "downloads": -1,
            "filename": "tinyface-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "15458685224e2a067bc0bf15bf0abd32",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 14003,
            "upload_time": "2024-11-10T03:17:26",
            "upload_time_iso_8601": "2024-11-10T03:17:26.016013Z",
            "url": "https://files.pythonhosted.org/packages/cb/9a/413bc4d00b450b90bfa7ac6ebba972d47bacaf6a39284f852b3d7fe78eb7/tinyface-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-10 03:17:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "idootop",
    "github_project": "TinyFace",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tinyface"
}
        
Elapsed time: 0.34102s