Name | perennityai-viz JSON |
Version |
0.1.0
JSON |
| download |
home_page | https://github.com/perennityai/perennityai-viz |
Summary | A Python tool for visualizing MediaPipe landmark data from CSV, Parquet, and TFRecord formats. |
upload_time | 2024-11-06 19:43:40 |
maintainer | None |
docs_url | None |
author | Perennity AI |
requires_python | >=3.8 |
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. |
keywords |
mediapipe
data visualization
landmarks
pose
ai
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PerennityAI MediaPipe Data Visualizer
```perennityai-viz``` is a tool to visualize hand, face, and pose landmarks from MediaPipe data with animations and overlay capabilities. It helps developers and researchers easily view MediaPipe data in a dynamic, combined format for visual analysis and debugging.
## Features
- Animation Creation: Generate animations from landmark data for face, hand, and pose.
- Visualization of Individual Components: Separate visualizations for hands, face, and body pose landmarks.
- Combined Image Output: Overlays landmarks for all components in a single image.
- Support for Multiple File Formats: Compatible with .csv, parquet, and .tfrecord file formats.
- Automated Data Processing: Filters and cleans data for efficient visualization.
## Configuration Requirements
This tool assumes that you have already generated or extracted landmark points with the correct headers specified in the configuration file configs/config.ini. If these landmarks are not yet available, please use ```perennityai-mp-gen``` to extract and save landmark data before running this tool.
## Data Requirements
The tool expects the following columns to be present in all input files:
1. `phrase`: The target label or identifier for each frame.
2. `frame`: The frame number or timestamp associated with each set of landmarks.
3. 1629 MediaPipe landmark points: Each landmark should be represented as x, y, and z coordinates, totaling 1629 values (e.g., `x_right_hand_0`, `x_left_hand_0`,`x_pose_0`, `x_face_0`, ..., `z_right_hand_20`, `z_left_hand_20`, `z_face_467`, `z_pose_32`).
Ensure that these columns are correctly formatted in the CSV, Parquet, or TFRecord files before running the tool.
# Project Structure
```
perennity-viz/
│
├── src/ # All source code in the 'src' folder
│ └── perennity_viz/ # 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_visualization/ # Folder for data visualization related code
│ ├── __init__.py # Initializes data_visualization module
│ └── data_visualizer.py # Main code for data visualization 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
```
## Demo
Here are some demonstrations of the features and functionalities of the project:
### 1: Gift vs Girafee ASL Gesture Visualization
![Gift vs Girafee ASL Gesture Visualization](https://github.com/perennityai/perennityai-viz/blob/main/demo/gift_girafee-demo.gif)
### 2: Girlfriend vs Girl ASL Gesture Visualization
![Girlfriend vs Girl ASL Gesture Visualization](https://github.com/perennityai/perennityai-viz/blob/main/demo/girlfriend_girl-demo.gif)
### 3: Girlfriend vs Girl ASL Gesture Visualization
![Glass vs Glasses ASL Gesture Visualization](https://github.com/perennityai/perennityai-viz/blob/main/demo/glass_glasses-demo.gif)
## Installation
Clone the repository and install required packages:
```bash
git clone https://github.com/your-username/perennityai-viz.git
cd perennityai-viz
pip install -r requirements.txt
```
## Usage
You can run the visualization tool directly from the command line. Use the following syntax:
```bash
pip install parennity-viz
# Ensure virtual environment path its in system path
perennityai-viz --input_file <file_path> --output_dir <output_directory> # For CSV --data_input_format not needed!
perennityai-viz --input_file <file_path> --output_dir <output_directory> --data_input_format parquet --verbose INFO
perennityai-viz --input_dir <file_path> --output_dir <output_directory> --csv_file_index 0 --data_input_format parquet
perennityai-viz --input_dir <file_path> --output_dir <output_directory> --tf_file_index 0 --data_input_format tfrecord --show 1
perennityai-viz --input_dir <file_path> --output_dir <output_directory> --parquet_file_index 0 --data_input_format parquet
```
## Command-Line Arguments
```bash
Options:
-h, --help Show this help message and exit.
--input_file INPUT_FILE
Specify a single CSV or TFRecord input file.
--input_dir INPUT_DIR
Directory containing multiple dataset files to process.
--output_dir OUTPUT_DIR
Directory to save generated animation files.
--data_input_format {csv,tfrecord,parquet}
Format of input data: "csv", "tfrecord", or "parquet".
--csv_file CSV_FILE Path to a specific CSV file for visualization.
--tfrecord_file TFRECORD_FILE
Path to a specific TFRecord file for visualization.
--parquet_file PARQUET_FILE
Path to a specific Parquet file for visualization.
--csv_file_index CSV_FILE_INDEX
Index of the CSV file within the input directory to visualize.
--tf_file_index TF_FILE_INDEX
Index of the TFRecord file within the input directory to visualize.
--parquet_file_index PARQUET_FILE_INDEX
Index of the Parquet file within the input directory to visualize.
--animation_name ANIMATION_NAME
Custom name for the output animation file.
--output_format {.gif,.mp4}
Format for the animation output, such as ".gif" or ".mp4".
--write WRITE Option to save the generated animation in the specified output directory.
--verbose {DEBUG,ERROR,WARNING}
Set logging level for output.
--encoding ENCODING Encoding format for CSV files.
--show: Displays animation in the browser
This tool leverages `FuncAnimation` to create frame-by-frame animations from data.
```
```python
conda create --name data-viz-env python=3.10
conda activate data-viz-env
pip install perennityai-viz
from perennity_viz.data_visualization.data_visualizer import DataVisualizer
# Usage Example: Load from a pretrained configuration file
try:
# Example of config file data
config = {
"input_file": "path/to/mp_landmarks_file/0.csv",
"input_dir": "path/to/mp_landmarks_file",
"output_dir": "path/to/output_directory",
"verbose": "INFO",
'encoding': 'ISO-8859-1' # CSV file encoding
}
# visualizer_from_pretrained = DataVisualizer.from_pretrained('path/to/config.json')
visualizer_from_pretrained = DataVisualizer.from_pretrained(config)
# Visualize the file, for example, with a CSV
animation = visualizer_from_pretrained.visualize_data(
tf_file_index=0 # index of CSV file in the input directory
)
# Process all samples and visualize .gif/mp4 file.
for csv_file in glob.glob(os.path.join("path/to/mp_landmarks_file", '*.csv')):
# Visualize the file, for example, with a CSV
visualizer_from_pretrained.visualize_data(
csv_file=csv_file
)
except FileNotFoundError as e:
print(f"Configuration loading failed: {e}")
```
## Key Classes and Methods
### DataVisualizer
Main class to handle data processing and visualization.
```
-- visualize_data: Visualizes data from a specified file by creating an animated view.
get_pose, get_face, get_hands: Methods to extract and visualize specific landmark types.
-- combine_images: Combines separate visualizations into a single, cohesive output.
-- create_animation: Generates an animation from landmark frames.
```
## 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-viz",
"name": "perennityai-viz",
"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/62/47/16965efc7a7a75dae9b100c2e800e5aeb4e71daae425500f2691e475ed36/perennityai_viz-0.1.0.tar.gz",
"platform": null,
"description": "# PerennityAI MediaPipe Data Visualizer\r\n```perennityai-viz``` is a tool to visualize hand, face, and pose landmarks from MediaPipe data with animations and overlay capabilities. It helps developers and researchers easily view MediaPipe data in a dynamic, combined format for visual analysis and debugging.\r\n\r\n## Features\r\n- Animation Creation: Generate animations from landmark data for face, hand, and pose.\r\n- Visualization of Individual Components: Separate visualizations for hands, face, and body pose landmarks.\r\n- Combined Image Output: Overlays landmarks for all components in a single image.\r\n- Support for Multiple File Formats: Compatible with .csv, parquet, and .tfrecord file formats.\r\n- Automated Data Processing: Filters and cleans data for efficient visualization.\r\n\r\n## Configuration Requirements\r\nThis tool assumes that you have already generated or extracted landmark points with the correct headers specified in the configuration file configs/config.ini. If these landmarks are not yet available, please use ```perennityai-mp-gen``` to extract and save landmark data before running this tool.\r\n\r\n## Data Requirements\r\nThe tool expects the following columns to be present in all input files:\r\n\r\n1. `phrase`: The target label or identifier for each frame.\r\n2. `frame`: The frame number or timestamp associated with each set of landmarks.\r\n3. 1629 MediaPipe landmark points: Each landmark should be represented as x, y, and z coordinates, totaling 1629 values (e.g., `x_right_hand_0`, `x_left_hand_0`,`x_pose_0`, `x_face_0`, ..., `z_right_hand_20`, `z_left_hand_20`, `z_face_467`, `z_pose_32`).\r\n\r\nEnsure that these columns are correctly formatted in the CSV, Parquet, or TFRecord files before running the tool.\r\n\r\n# Project Structure\r\n\r\n```\r\nperennity-viz/\r\n\u2502\r\n\u251c\u2500\u2500 src/ # All source code in the 'src' folder\r\n\u2502 \u2514\u2500\u2500 perennity_viz/ # 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_visualization/ # Folder for data visualization related code\r\n\u2502 \u251c\u2500\u2500 __init__.py # Initializes data_visualization module\r\n\u2502 \u2514\u2500\u2500 data_visualizer.py # Main code for data visualization 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## Demo\r\nHere are some demonstrations of the features and functionalities of the project:\r\n\r\n### 1: Gift vs Girafee ASL Gesture Visualization\r\n![Gift vs Girafee ASL Gesture Visualization](https://github.com/perennityai/perennityai-viz/blob/main/demo/gift_girafee-demo.gif)\r\n\r\n### 2: Girlfriend vs Girl ASL Gesture Visualization\r\n![Girlfriend vs Girl ASL Gesture Visualization](https://github.com/perennityai/perennityai-viz/blob/main/demo/girlfriend_girl-demo.gif)\r\n\r\n### 3: Girlfriend vs Girl ASL Gesture Visualization\r\n![Glass vs Glasses ASL Gesture Visualization](https://github.com/perennityai/perennityai-viz/blob/main/demo/glass_glasses-demo.gif)\r\n\r\n\r\n## Installation\r\n\r\nClone the repository and install required packages:\r\n\r\n```bash\r\ngit clone https://github.com/your-username/perennityai-viz.git\r\ncd perennityai-viz\r\npip install -r requirements.txt\r\n```\r\n\r\n## Usage\r\nYou can run the visualization tool directly from the command line. Use the following syntax:\r\n\r\n```bash\r\npip install parennity-viz\r\n\r\n# Ensure virtual environment path its in system path\r\n\r\nperennityai-viz --input_file <file_path> --output_dir <output_directory> # For CSV --data_input_format not needed!\r\nperennityai-viz --input_file <file_path> --output_dir <output_directory> --data_input_format parquet --verbose INFO\r\nperennityai-viz --input_dir <file_path> --output_dir <output_directory> --csv_file_index 0 --data_input_format parquet\r\nperennityai-viz --input_dir <file_path> --output_dir <output_directory> --tf_file_index 0 --data_input_format tfrecord --show 1\r\nperennityai-viz --input_dir <file_path> --output_dir <output_directory> --parquet_file_index 0 --data_input_format parquet\r\n\r\n```\r\n\r\n## Command-Line Arguments\r\n```bash\r\nOptions:\r\n -h, --help Show this help message and exit.\r\n --input_file INPUT_FILE\r\n Specify a single CSV or TFRecord input file.\r\n --input_dir INPUT_DIR\r\n Directory containing multiple dataset files to process.\r\n --output_dir OUTPUT_DIR\r\n Directory to save generated animation files.\r\n --data_input_format {csv,tfrecord,parquet}\r\n Format of input data: \"csv\", \"tfrecord\", or \"parquet\".\r\n --csv_file CSV_FILE Path to a specific CSV file for visualization.\r\n --tfrecord_file TFRECORD_FILE\r\n Path to a specific TFRecord file for visualization.\r\n --parquet_file PARQUET_FILE\r\n Path to a specific Parquet file for visualization.\r\n --csv_file_index CSV_FILE_INDEX\r\n Index of the CSV file within the input directory to visualize.\r\n --tf_file_index TF_FILE_INDEX\r\n Index of the TFRecord file within the input directory to visualize.\r\n --parquet_file_index PARQUET_FILE_INDEX\r\n Index of the Parquet file within the input directory to visualize.\r\n --animation_name ANIMATION_NAME\r\n Custom name for the output animation file.\r\n --output_format {.gif,.mp4}\r\n Format for the animation output, such as \".gif\" or \".mp4\".\r\n --write WRITE Option to save the generated animation in the specified output directory.\r\n --verbose {DEBUG,ERROR,WARNING}\r\n Set logging level for output.\r\n --encoding ENCODING Encoding format for CSV files.\r\n\r\n --show: Displays animation in the browser\r\n\r\nThis tool leverages `FuncAnimation` to create frame-by-frame animations from data.\r\n\r\n\r\n\r\n```\r\n\r\n\r\n```python\r\n\r\nconda create --name data-viz-env python=3.10\r\n\r\nconda activate data-viz-env\r\n\r\npip install perennityai-viz\r\nfrom perennity_viz.data_visualization.data_visualizer import DataVisualizer\r\n\r\n# Usage Example: Load from a pretrained configuration file\r\ntry:\r\n # Example of config file data\r\n config = {\r\n \"input_file\": \"path/to/mp_landmarks_file/0.csv\",\r\n \"input_dir\": \"path/to/mp_landmarks_file\",\r\n \"output_dir\": \"path/to/output_directory\",\r\n \"verbose\": \"INFO\",\r\n 'encoding': 'ISO-8859-1' # CSV file encoding\r\n }\r\n\r\n\r\n # visualizer_from_pretrained = DataVisualizer.from_pretrained('path/to/config.json')\r\n visualizer_from_pretrained = DataVisualizer.from_pretrained(config)\r\n \r\n # Visualize the file, for example, with a CSV\r\n animation = visualizer_from_pretrained.visualize_data(\r\n tf_file_index=0 # index of CSV file in the input directory\r\n )\r\n\r\n # Process all samples and visualize .gif/mp4 file.\r\n for csv_file in glob.glob(os.path.join(\"path/to/mp_landmarks_file\", '*.csv')):\r\n # Visualize the file, for example, with a CSV\r\n visualizer_from_pretrained.visualize_data(\r\n csv_file=csv_file\r\n )\r\n\r\nexcept FileNotFoundError as e:\r\n print(f\"Configuration loading failed: {e}\")\r\n```\r\n\r\n## Key Classes and Methods\r\n### DataVisualizer\r\nMain class to handle data processing and visualization.\r\n```\r\n-- visualize_data: Visualizes data from a specified file by creating an animated view.\r\nget_pose, get_face, get_hands: Methods to extract and visualize specific landmark types.\r\n\r\n-- combine_images: Combines separate visualizations into a single, cohesive output.\r\n\r\n-- create_animation: Generates an animation from landmark frames.\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 Python tool for visualizing MediaPipe landmark data from CSV, Parquet, and TFRecord formats.",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/perennityai/perennityai-viz/blob/main/README.md",
"Homepage": "https://github.com/perennityai/perennityai-viz",
"Issue Tracker": "https://github.com/perennityai/perennityai-viz/issues"
},
"split_keywords": [
"mediapipe",
" data visualization",
" landmarks",
" pose",
" ai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "807620fe4cf976feb1ff0dab89b4decd8f807b8d57d14d88b4bf9d97876a55a2",
"md5": "846abdeb1f050a5b6f30b57fdc9cd99f",
"sha256": "65b011a46d79a4d4e2defb420e4f25bebcd38b3d715dc8f3ae1c00c82bffd20b"
},
"downloads": -1,
"filename": "perennityai_viz-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "846abdeb1f050a5b6f30b57fdc9cd99f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 26882,
"upload_time": "2024-11-06T19:43:36",
"upload_time_iso_8601": "2024-11-06T19:43:36.471527Z",
"url": "https://files.pythonhosted.org/packages/80/76/20fe4cf976feb1ff0dab89b4decd8f807b8d57d14d88b4bf9d97876a55a2/perennityai_viz-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "624716965efc7a7a75dae9b100c2e800e5aeb4e71daae425500f2691e475ed36",
"md5": "fb7d04decd74d249b2111a6c6d8e69e7",
"sha256": "401e728ce24e2b44972aeb1861b22fca440040ead429535b4cc2db0b78794183"
},
"downloads": -1,
"filename": "perennityai_viz-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "fb7d04decd74d249b2111a6c6d8e69e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 29506,
"upload_time": "2024-11-06T19:43:40",
"upload_time_iso_8601": "2024-11-06T19:43:40.964551Z",
"url": "https://files.pythonhosted.org/packages/62/47/16965efc7a7a75dae9b100c2e800e5aeb4e71daae425500f2691e475ed36/perennityai_viz-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-06 19:43:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "perennityai",
"github_project": "perennityai-viz",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "perennityai-viz"
}