perennityai-mp-extract


Nameperennityai-mp-extract JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/perennityai/perennityai-mp-extract
SummaryA tool for extracting gesture landmarks and metadata from videos and saving them to disk using MediaPipe.
upload_time2024-11-07 04:37:00
maintainerNone
docs_urlNone
authorPerennity AI
requires_python>=3.8
licenseMIT License Copyright (c) 2024 PerennityAI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords mediapipe data visualization landmarks pose ai
VCS
bugtrack_url
requirements tensorflow tensorboard keras numpy pandas requests json5 opencv-python mediapipe ipython yt_dlp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PerennityAI MediaPipe Face, Pose, and Hands Landmarks Extractor
```perennityai-mp-extract``` is a tool designed to help developers and researchers easily extract hand, face, and pose landmarks from video files. By leveraging state-of-the-art MediaPipe models, this tool simplifies the process of obtaining precise gesture data, enabling the development of advanced touchless human-computer interaction (HCI) systems, gesture recognition models, and more.

With a user-friendly interface, perennityai-mp-extract allows users to process videos at a specified frame rate, providing flexibility to extract the data in various formats, including CSV, JSON, TFRecord, or Parquet. Whether you're working on sign language recognition, gesture-based controls, or any other HCI project, this tool streamlines the extraction of key visual data points, making it easier to integrate gesture analysis into your applications.

## Key Features:

- Hand, Face, and Pose Landmark Extraction: Leverages MediaPipe to extract detailed landmarks for hand gestures, facial expressions, and body poses.
- Flexible Output Formats: Save the extracted data in CSV, TFRecord, or Parquet formats for easy integration with machine learning workflows.
- Customizable Frame Rate: Extract data at your preferred frame rate for accurate analysis.
- Robust Logging: Integrated logging functionality for monitoring and debugging extraction processes.
- Easy Integration: Easily integrates into existing data pipelines and research projects.

## Target Audience:

- Developers: Looking to add gesture recognition, sign language support, or touchless controls to applications.
- Researchers: Working on human-computer interaction, computer vision, or machine learning projects involving video data.
- Data Scientists: Who require accurate landmark data for training models and evaluating visual recognition systems.

## Data Requirements
To use perennityai-mp-extract for extracting hand, face, and pose landmarks, the following data is required:

### Valid Video URL or Video File:
- The tool can process video files from various sources, including local files (e.g., .mp4, .avi, .mov, .webm) or direct URLs to online videos (e.g., YouTube URLs).
- Supported video file formats include common formats such as .mp4, .mov, .avi, .webm, .ogg, and more.
# Video Label or Target Text:
- A label or short target text to associate with the video. This could represent the action, gesture, or context of the video (e.g., "sign language gesture", "hello gesture", "exercise pose", etc.).
- The label helps organize and identify the extracted landmarks when they are saved to output files, and it is also included in the metadata associated with the video.

# Project Structure
```
perennity-mp-extract/
│
├── src/                              # All source code in the 'src' folder
│   └── perennity_mp_extract/          # Your main package/module
│       ├── __init__.py               # Initializes the package/module
│       ├── main.py                   # Entry point for running the program
│       │
│       ├── utils/                    # Utilities folder (for helpers, etc.)
│       │   ├── __init__.py           # Initializes utils module
│       │   ├── csv_handler.py        # Handles CSV file operations
│       │   ├── tfrecord_processor.py # Handles TFRecord file operations
│       │   ├── feature_header.py     # The points labels for all landmarks
│       │   └── logger.py             # Logger configuration and functions
│       │
│       └── data_extraction/          # Folder for data extraction related code
│           ├── __init__.py           # Initializes data_extraction module
│           └── data_extractor.py     # Main code for data extraction logic
│
├── tests/                            # Unit tests and test files
│   
├── MANIFEST.in                       # Specifies additional files for packaging
├── pyproject.toml                    # Build system configuration
├── setup.py                          # Package setup file
├── README.md                         # Project documentation
├── LICENSE                           # License file
└── requirements.txt                  # Dependencies for development

```

## Usage
You can run the extraction tool directly from the command line. Use the following syntax:

```bash
pip install perennityai-mp-extract

# Ensure  virtual environment path its in system path
perennityai-mp-extract   --input_file https://www.example.com/23/23781.mp4 --output_dir ./path/to/storage --output_format csv --label gift --verbose DEBUG 

```

## Command-Line Arguments
```bash
Options:
--input_file: Specifies the path to the input video file. The tool supports multiple formats, including .mp4, .avi, .mov, .ogg, etc.
--output_dir: Indicates the directory where the processed output files (landmarks and metadata) will be saved.
--label: Allows the user to assign a label to the landmarks from the video, useful for classification or organization.
--output_format: Selects the output file format. Options include csv, tfrecord, or parquet, with csv as the default.
--frame_rate: Defines the frequency of frame processing. This can be adjusted for faster processing or more detailed frame-by-frame extraction.
--verbose: Controls the logging level for output, providing flexibility in logging output for debugging or streamlined logging.
```

## Installation
Clone the repository and install required packages:

```bash
git clone https://github.com/perennityai/perennityai-mp-extract.git
cd perennityai-mp-extract
pip install -r requirements.txt

python main.py --input_file https://www.example.com/23/23781.mp4 --output_dir ./path/to/storage --output_format csv --label gift --verbose DEBUG 
```

```bash

conda create --name mp-extract-env python=3.8

conda activate mp-extract-env

pip install perennityai-mp-extract
```

```python
from perennityai_mp_extract.data_extraction.data_extractor import DataExtractor

# Usage Example: Load from a pretrained configuration file

try:
    # Example of config file data:
    # This configuration dictionary specifies the output directory, format, and verbosity level.
    config = {
        'output_dir': 'path/to/output_directory',  # Directory to save extracted data
        'output_format': 'tfrecord',  # Format of output files (csv, tfrecord, or parquet)
        'verbose': 'INFO',  # Logging level to control output verbosity
    }

    # Initialize the DataExtractor with the configuration settings
    extractor = DataExtractor(config=config)

    # Alternatively, load configuration from a pretrained JSON config file
    # extractor = DataExtractor.from_pretrained('path/to/config.json')
    
    # Extract landmarks from a given video file
    # The 'extract' method processes the video and saves the output based on config settings
    animation = extractor.extract('your_video_url', 'label')  # 'label' is a custom tag for the video

except FileNotFoundError as e:
    # Handle cases where the configuration file is missing
    print(f"Configuration loading failed: {e}")

```

## Key Classes and Methods
```
perennity_mp_extract/
- __init__.py: Initializes the main perennity_mp_extract package for import.
main.py
- parse_arguments(): Parses command-line arguments for data extraction options.
- main(): Runs the DataExtractor with provided arguments to perform data extraction.

utils/
- __init__.py: Initializes the utils module for import.
- csv_handler.py: Manages CSV file read and write operations for landmarks data.
- tfrecord_processor.py: Handles saving and loading of TFRecord files.
- feature_header.py: Stores label names for all landmark points.
- logger.py: Configures and provides logging functionality for the package.

data_extraction/
- __init__.py: Initializes the data_extraction module for import.
- data_extractor.py: Core logic for extracting landmarks from video and saving in various formats.
```

## License
This project is licensed under the MIT License. See the LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/perennityai/perennityai-mp-extract",
    "name": "perennityai-mp-extract",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "mediapipe, data visualization, landmarks, pose, AI",
    "author": "Perennity AI",
    "author_email": "Perennity AI <info@perennityai.com>",
    "download_url": "https://files.pythonhosted.org/packages/69/6a/ca42753f6caa264601d06bf609dd1aac7a425f4dd96797f4ea3aa31bb7b7/perennityai_mp_extract-0.1.0.tar.gz",
    "platform": null,
    "description": "# PerennityAI MediaPipe Face, Pose, and Hands Landmarks Extractor\r\n```perennityai-mp-extract``` is a tool designed to help developers and researchers easily extract hand, face, and pose landmarks from video files. By leveraging state-of-the-art MediaPipe models, this tool simplifies the process of obtaining precise gesture data, enabling the development of advanced touchless human-computer interaction (HCI) systems, gesture recognition models, and more.\r\n\r\nWith a user-friendly interface, perennityai-mp-extract allows users to process videos at a specified frame rate, providing flexibility to extract the data in various formats, including CSV, JSON, TFRecord, or Parquet. Whether you're working on sign language recognition, gesture-based controls, or any other HCI project, this tool streamlines the extraction of key visual data points, making it easier to integrate gesture analysis into your applications.\r\n\r\n## Key Features:\r\n\r\n- Hand, Face, and Pose Landmark Extraction: Leverages MediaPipe to extract detailed landmarks for hand gestures, facial expressions, and body poses.\r\n- Flexible Output Formats: Save the extracted data in CSV, TFRecord, or Parquet formats for easy integration with machine learning workflows.\r\n- Customizable Frame Rate: Extract data at your preferred frame rate for accurate analysis.\r\n- Robust Logging: Integrated logging functionality for monitoring and debugging extraction processes.\r\n- Easy Integration: Easily integrates into existing data pipelines and research projects.\r\n\r\n## Target Audience:\r\n\r\n- Developers: Looking to add gesture recognition, sign language support, or touchless controls to applications.\r\n- Researchers: Working on human-computer interaction, computer vision, or machine learning projects involving video data.\r\n- Data Scientists: Who require accurate landmark data for training models and evaluating visual recognition systems.\r\n\r\n## Data Requirements\r\nTo use perennityai-mp-extract for extracting hand, face, and pose landmarks, the following data is required:\r\n\r\n### Valid Video URL or Video File:\r\n- The tool can process video files from various sources, including local files (e.g., .mp4, .avi, .mov, .webm) or direct URLs to online videos (e.g., YouTube URLs).\r\n- Supported video file formats include common formats such as .mp4, .mov, .avi, .webm, .ogg, and more.\r\n# Video Label or Target Text:\r\n- A label or short target text to associate with the video. This could represent the action, gesture, or context of the video (e.g., \"sign language gesture\", \"hello gesture\", \"exercise pose\", etc.).\r\n- The label helps organize and identify the extracted landmarks when they are saved to output files, and it is also included in the metadata associated with the video.\r\n\r\n# Project Structure\r\n```\r\nperennity-mp-extract/\r\n\u2502\r\n\u251c\u2500\u2500 src/                              # All source code in the 'src' folder\r\n\u2502   \u2514\u2500\u2500 perennity_mp_extract/          # Your main package/module\r\n\u2502       \u251c\u2500\u2500 __init__.py               # Initializes the package/module\r\n\u2502       \u251c\u2500\u2500 main.py                   # Entry point for running the program\r\n\u2502       \u2502\r\n\u2502       \u251c\u2500\u2500 utils/                    # Utilities folder (for helpers, etc.)\r\n\u2502       \u2502   \u251c\u2500\u2500 __init__.py           # Initializes utils module\r\n\u2502       \u2502   \u251c\u2500\u2500 csv_handler.py        # Handles CSV file operations\r\n\u2502       \u2502   \u251c\u2500\u2500 tfrecord_processor.py # Handles TFRecord file operations\r\n\u2502       \u2502   \u251c\u2500\u2500 feature_header.py     # The points labels for all landmarks\r\n\u2502       \u2502   \u2514\u2500\u2500 logger.py             # Logger configuration and functions\r\n\u2502       \u2502\r\n\u2502       \u2514\u2500\u2500 data_extraction/          # Folder for data extraction related code\r\n\u2502           \u251c\u2500\u2500 __init__.py           # Initializes data_extraction module\r\n\u2502           \u2514\u2500\u2500 data_extractor.py     # Main code for data extraction logic\r\n\u2502\r\n\u251c\u2500\u2500 tests/                            # Unit tests and test files\r\n\u2502   \r\n\u251c\u2500\u2500 MANIFEST.in                       # Specifies additional files for packaging\r\n\u251c\u2500\u2500 pyproject.toml                    # Build system configuration\r\n\u251c\u2500\u2500 setup.py                          # Package setup file\r\n\u251c\u2500\u2500 README.md                         # Project documentation\r\n\u251c\u2500\u2500 LICENSE                           # License file\r\n\u2514\u2500\u2500 requirements.txt                  # Dependencies for development\r\n\r\n```\r\n\r\n## Usage\r\nYou can run the extraction tool directly from the command line. Use the following syntax:\r\n\r\n```bash\r\npip install perennityai-mp-extract\r\n\r\n# Ensure  virtual environment path its in system path\r\nperennityai-mp-extract   --input_file https://www.example.com/23/23781.mp4 --output_dir ./path/to/storage --output_format csv --label gift --verbose DEBUG \r\n\r\n```\r\n\r\n## Command-Line Arguments\r\n```bash\r\nOptions:\r\n--input_file: Specifies the path to the input video file. The tool supports multiple formats, including .mp4, .avi, .mov, .ogg, etc.\r\n--output_dir: Indicates the directory where the processed output files (landmarks and metadata) will be saved.\r\n--label: Allows the user to assign a label to the landmarks from the video, useful for classification or organization.\r\n--output_format: Selects the output file format. Options include csv, tfrecord, or parquet, with csv as the default.\r\n--frame_rate: Defines the frequency of frame processing. This can be adjusted for faster processing or more detailed frame-by-frame extraction.\r\n--verbose: Controls the logging level for output, providing flexibility in logging output for debugging or streamlined logging.\r\n```\r\n\r\n## Installation\r\nClone the repository and install required packages:\r\n\r\n```bash\r\ngit clone https://github.com/perennityai/perennityai-mp-extract.git\r\ncd perennityai-mp-extract\r\npip install -r requirements.txt\r\n\r\npython main.py --input_file https://www.example.com/23/23781.mp4 --output_dir ./path/to/storage --output_format csv --label gift --verbose DEBUG \r\n```\r\n\r\n```bash\r\n\r\nconda create --name mp-extract-env python=3.8\r\n\r\nconda activate mp-extract-env\r\n\r\npip install perennityai-mp-extract\r\n```\r\n\r\n```python\r\nfrom perennityai_mp_extract.data_extraction.data_extractor import DataExtractor\r\n\r\n# Usage Example: Load from a pretrained configuration file\r\n\r\ntry:\r\n    # Example of config file data:\r\n    # This configuration dictionary specifies the output directory, format, and verbosity level.\r\n    config = {\r\n        'output_dir': 'path/to/output_directory',  # Directory to save extracted data\r\n        'output_format': 'tfrecord',  # Format of output files (csv, tfrecord, or parquet)\r\n        'verbose': 'INFO',  # Logging level to control output verbosity\r\n    }\r\n\r\n    # Initialize the DataExtractor with the configuration settings\r\n    extractor = DataExtractor(config=config)\r\n\r\n    # Alternatively, load configuration from a pretrained JSON config file\r\n    # extractor = DataExtractor.from_pretrained('path/to/config.json')\r\n    \r\n    # Extract landmarks from a given video file\r\n    # The 'extract' method processes the video and saves the output based on config settings\r\n    animation = extractor.extract('your_video_url', 'label')  # 'label' is a custom tag for the video\r\n\r\nexcept FileNotFoundError as e:\r\n    # Handle cases where the configuration file is missing\r\n    print(f\"Configuration loading failed: {e}\")\r\n\r\n```\r\n\r\n## Key Classes and Methods\r\n```\r\nperennity_mp_extract/\r\n- __init__.py: Initializes the main perennity_mp_extract package for import.\r\nmain.py\r\n- parse_arguments(): Parses command-line arguments for data extraction options.\r\n- main(): Runs the DataExtractor with provided arguments to perform data extraction.\r\n\r\nutils/\r\n- __init__.py: Initializes the utils module for import.\r\n- csv_handler.py: Manages CSV file read and write operations for landmarks data.\r\n- tfrecord_processor.py: Handles saving and loading of TFRecord files.\r\n- feature_header.py: Stores label names for all landmark points.\r\n- logger.py: Configures and provides logging functionality for the package.\r\n\r\ndata_extraction/\r\n- __init__.py: Initializes the data_extraction module for import.\r\n- data_extractor.py: Core logic for extracting landmarks from video and saving in various formats.\r\n```\r\n\r\n## License\r\nThis project is licensed under the MIT License. See the LICENSE file for details.\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 PerennityAI  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A tool for extracting gesture landmarks and metadata from videos and saving them to disk using MediaPipe.",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/perennityai/perennityai-mp-extract/blob/main/README.md",
        "Homepage": "https://github.com/perennityai/perennityai-mp-extract",
        "Issue Tracker": "https://github.com/perennityai/perennityai-mp-extract/issues"
    },
    "split_keywords": [
        "mediapipe",
        " data visualization",
        " landmarks",
        " pose",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a29b64a9442ac971b81b01a14cecb297d5ba50bac296c2e21eec4e302a8a4a5",
                "md5": "5815b2d161977c8a34eef7d842218f27",
                "sha256": "2dfca37127669579a6893eff124185c4a1684fb09c52af9d9283ea3b27b69a8e"
            },
            "downloads": -1,
            "filename": "perennityai_mp_extract-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5815b2d161977c8a34eef7d842218f27",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 25251,
            "upload_time": "2024-11-07T04:36:58",
            "upload_time_iso_8601": "2024-11-07T04:36:58.197377Z",
            "url": "https://files.pythonhosted.org/packages/8a/29/b64a9442ac971b81b01a14cecb297d5ba50bac296c2e21eec4e302a8a4a5/perennityai_mp_extract-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "696aca42753f6caa264601d06bf609dd1aac7a425f4dd96797f4ea3aa31bb7b7",
                "md5": "db473ca51a3bfb00ec0da6a0b867edfe",
                "sha256": "d417e6530554737f4fec83d2fb723fb9f508ac90a7312822d81b1b2c3c029774"
            },
            "downloads": -1,
            "filename": "perennityai_mp_extract-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "db473ca51a3bfb00ec0da6a0b867edfe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 27752,
            "upload_time": "2024-11-07T04:37:00",
            "upload_time_iso_8601": "2024-11-07T04:37:00.210831Z",
            "url": "https://files.pythonhosted.org/packages/69/6a/ca42753f6caa264601d06bf609dd1aac7a425f4dd96797f4ea3aa31bb7b7/perennityai_mp_extract-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-07 04:37:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "perennityai",
    "github_project": "perennityai-mp-extract",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "tensorflow",
            "specs": [
                [
                    "==",
                    "2.12.0"
                ]
            ]
        },
        {
            "name": "tensorboard",
            "specs": [
                [
                    "==",
                    "2.12.3"
                ]
            ]
        },
        {
            "name": "keras",
            "specs": [
                [
                    "==",
                    "2.12.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.23.5"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "1.5.3"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "json5",
            "specs": []
        },
        {
            "name": "opencv-python",
            "specs": []
        },
        {
            "name": "mediapipe",
            "specs": []
        },
        {
            "name": "ipython",
            "specs": []
        },
        {
            "name": "yt_dlp",
            "specs": []
        }
    ],
    "lcname": "perennityai-mp-extract"
}
        
Elapsed time: 0.44662s