ImgDataConvertCodeGen


NameImgDataConvertCodeGen JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/c3di/ImgDataConvertCodeGen
SummaryAutomatically generating conversion code for in-memory representations of images using a knowledge graph of data types.
upload_time2024-04-09 10:27:58
maintainerNone
docs_urlNone
authorFei Chen
requires_python<3.12,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # imgdataconvertcodegen

[![PyPI - Version](https://img.shields.io/pypi/v/imgdataconvertcodegen.svg)](https://pypi.org/project/imgdataconvertcodegen/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/imgdataconvertcodegen)](https://pypi.org/project/imgdataconvertcodegen/)
[![Documentation](https://img.shields.io/badge/Doc-ReadMe-blue)](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/README.md)
[![Tests](https://github.com/c3di/ImgDataConvertCodeGen/actions/workflows/python%20tests%20with%20coverage.yml/badge.svg)](https://github.com/c3di/ImgDataConvertCodeGen/actions/workflows/python%20tests%20with%20coverage.yml)
[![codecov](https://codecov.io/github/c3di/ImgDataConvertCodeGen/graph/badge.svg?token=BWBXANX8W7)](https://codecov.io/github/c3di/ImgDataConvertCodeGen)

The `imgdataconvertcodegen` package offers an automated approach to generate conversion code for in-memory image representations, such as `numpy.ndarray`, `torch.tensor`, `PIL.Image`, and others using a knowledge graph of data types.

At the core of the package is a knowledge graph in which nodes represent data types and edges represent conversion code snippets between the data types. By traversing the path from source to target data types within the graph, the package collect each conversion code snippet along the path to generate the final conversion code.


## Installation

Install the package via pip:
```bash
pip install imgdataconvertcodegen
```
## Usage

One example from the image data in numpy to the image data in PyTorch:
```python
from imgdataconvertcodegen import get_conversion_code

source_image_desc = {"lib": "numpy"}
target_image_desc = {"lib": "torch", "image_dtype": "uint8"}
code = get_conversion_code("source_image", source_image_desc, "target_image", target_image_desc)
```
The generated conversion code will be as follows:
```python
import torch
image = torch.from_numpy(source_image)
image = image.permute(2, 0, 1)
target_image = torch.unsqueeze(image, 0)
```

## Evaluation


**Accuracy**

All primitive conversion code snippets are stored within the edges of the knowledge graph. These snippets are verified through execution checks to guarantee their correctness. For a more in-depth examination, please refer to the [`test_conversion_code_in_kg.py`](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/tests/test_conversion_code_in_kg.py).

**Performance profiling**

The performance of knowledge graph construction and code generation processes is meticulously analyzed using the cProfile module. For comprehensive insights, please refer to the [`profiling notebooks`](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/profile).

**Usability Evaluation**

Please refer to [Usability Evaluation](https://github.com/c3di/ImgDataConvertCodeGen_Evaluation).

## Development


For detailed instructions on developing, building, and publishing this package, please refer to the [README_DEV](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/README_Dev.md).


## Cite

if you use our tool or code in your research, please cite the following paper:

Todo

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/c3di/ImgDataConvertCodeGen",
    "name": "ImgDataConvertCodeGen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Fei Chen",
    "author_email": "boxchenfei@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ff/01/212bfa8dd09501399346eefa2cb1d3b81e86359a10e444f2b902d4840998/ImgDataConvertCodeGen-0.0.2.tar.gz",
    "platform": "any",
    "description": "# imgdataconvertcodegen\n\n[![PyPI - Version](https://img.shields.io/pypi/v/imgdataconvertcodegen.svg)](https://pypi.org/project/imgdataconvertcodegen/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/imgdataconvertcodegen)](https://pypi.org/project/imgdataconvertcodegen/)\n[![Documentation](https://img.shields.io/badge/Doc-ReadMe-blue)](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/README.md)\n[![Tests](https://github.com/c3di/ImgDataConvertCodeGen/actions/workflows/python%20tests%20with%20coverage.yml/badge.svg)](https://github.com/c3di/ImgDataConvertCodeGen/actions/workflows/python%20tests%20with%20coverage.yml)\n[![codecov](https://codecov.io/github/c3di/ImgDataConvertCodeGen/graph/badge.svg?token=BWBXANX8W7)](https://codecov.io/github/c3di/ImgDataConvertCodeGen)\n\nThe `imgdataconvertcodegen` package offers an automated approach to generate conversion code for in-memory image representations, such as `numpy.ndarray`, `torch.tensor`, `PIL.Image`, and others using a knowledge graph of data types.\n\nAt the core of the package is a knowledge graph in which nodes represent data types and edges represent conversion code snippets between the data types. By traversing the path from source to target data types within the graph, the package collect each conversion code snippet along the path to generate the final conversion code.\n\n\n## Installation\n\nInstall the package via pip:\n```bash\npip install imgdataconvertcodegen\n```\n## Usage\n\nOne example from the image data in numpy to the image data in PyTorch:\n```python\nfrom imgdataconvertcodegen import get_conversion_code\n\nsource_image_desc = {\"lib\": \"numpy\"}\ntarget_image_desc = {\"lib\": \"torch\", \"image_dtype\": \"uint8\"}\ncode = get_conversion_code(\"source_image\", source_image_desc, \"target_image\", target_image_desc)\n```\nThe generated conversion code will be as follows:\n```python\nimport torch\nimage = torch.from_numpy(source_image)\nimage = image.permute(2, 0, 1)\ntarget_image = torch.unsqueeze(image, 0)\n```\n\n## Evaluation\n\n\n**Accuracy**\n\nAll primitive conversion code snippets are stored within the edges of the knowledge graph. These snippets are verified through execution checks to guarantee their correctness. For a more in-depth examination, please refer to the [`test_conversion_code_in_kg.py`](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/tests/test_conversion_code_in_kg.py).\n\n**Performance profiling**\n\nThe performance of knowledge graph construction and code generation processes is meticulously analyzed using the cProfile module. For comprehensive insights, please refer to the [`profiling notebooks`](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/profile).\n\n**Usability Evaluation**\n\nPlease refer to [Usability Evaluation](https://github.com/c3di/ImgDataConvertCodeGen_Evaluation).\n\n## Development\n\n\nFor detailed instructions on developing, building, and publishing this package, please refer to the [README_DEV](https://github.com/c3di/ImgDataConvertCodeGen/blob/main/README_Dev.md).\n\n\n## Cite\n\nif you use our tool or code in your research, please cite the following paper:\n\nTodo\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Automatically generating conversion code for in-memory representations of images using a knowledge graph of data types.",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/c3di/ImgDataConvertCodeGen",
        "Source": "https://github.com/c3di/ImgDataConvertCodeGen/",
        "Tracker": "https://github.com/c3di/ImgDataConvertCodeGen/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08e21f27f2f22c5877a720a362a6ede5c75fbaa2afcdb01c2f033982151e8508",
                "md5": "de5841944886c642f792ad064bf05613",
                "sha256": "ea2410744bd374b551cbce4f36f582e7cee3f12afea2caff31aa2ef4d194be11"
            },
            "downloads": -1,
            "filename": "ImgDataConvertCodeGen-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "de5841944886c642f792ad064bf05613",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.9",
            "size": 31634,
            "upload_time": "2024-04-09T10:27:56",
            "upload_time_iso_8601": "2024-04-09T10:27:56.197154Z",
            "url": "https://files.pythonhosted.org/packages/08/e2/1f27f2f22c5877a720a362a6ede5c75fbaa2afcdb01c2f033982151e8508/ImgDataConvertCodeGen-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff01212bfa8dd09501399346eefa2cb1d3b81e86359a10e444f2b902d4840998",
                "md5": "4dddf42b68e80f985494e56ceaf238cc",
                "sha256": "4b5da1b9498a708eb9a47f2454e42a3de493b1951b8ef15cf01fb325df23fcd2"
            },
            "downloads": -1,
            "filename": "ImgDataConvertCodeGen-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4dddf42b68e80f985494e56ceaf238cc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.9",
            "size": 111169,
            "upload_time": "2024-04-09T10:27:58",
            "upload_time_iso_8601": "2024-04-09T10:27:58.100233Z",
            "url": "https://files.pythonhosted.org/packages/ff/01/212bfa8dd09501399346eefa2cb1d3b81e86359a10e444f2b902d4840998/ImgDataConvertCodeGen-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 10:27:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "c3di",
    "github_project": "ImgDataConvertCodeGen",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "imgdataconvertcodegen"
}
        
Elapsed time: 0.26759s