im2im


Nameim2im JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/c3di/im2im
SummaryAutomatically converting in-memory representations of images using a knowledge graph of type description.
upload_time2024-04-10 18:10:53
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
            # im2im

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

The `im2im` package provides an automated approach for converting in-memory image representations across a variety of image processing libraries, including `numpy`, `opencv-python`, `torch`, `PIL`, `Matplotlib.plt.imshow`, and `Tensorflow`. It handles the nuances inherent to each library's image representation, such as data formats (numpy arrays, PIL images, torch tensors, and so on), color channel (RGB or grayscale), channel order (channel first or last or none), device (CPU/GPU), and pixel intensity ranges.


At the core of the package is a knowledge graph, where each node encapsulates metadata detailing an image representation, and the edges between nodes represent code snippets for converting images from one representation to another. When converting from the source to the target, the `im2im` package identifies the shortest path within the graph,  it gathers all relevant conversion snippets encountered along the path. These snippets are then combined to formulate the final conversion code, which is subsequently employed to transform the source images into the desired target format.


## Installation

Install the package via pip:
```bash
pip install im2im
```


## Usage

One example from the image data in numpy to the image data in PyTorch:
```python
import numpy as np
from im2im import im2im

source = np.random.randint(0, 256, (20, 20, 3), dtype=np.uint8)
target = im2im(source, {"lib": "numpy"}, {"lib": "torch", "color_channel":"gray", "image_dtype": "uint8"})
```

For other APIs like `im2im_code`, and `im2im_path`, please refer to [tutorials](https://github.com/c3di/im2im/blob/main/tutorial.ipynb) or [public APIs](https://github.com/c3di/im2im/blob/main/src/im2im/interface_py_api.py).

## Knowledge Graph Extension

Our package is designed for easy knowledge graph extension. Once you are familiar with the mechanisms behind the construction of the knowledge graph, you can leverage a suite of functions designed for various extension requirements including `add_meta_values_for_image`, `add_edge_factory_cluster`, and `add_conversion_for_metadata_pairs`, each tailored for different extension needs. 

## 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/im2im/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/im2im/blob/main/profile).

**Usability Evaluation**

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

## Contribution

We welcome all contributions to this project! If you have suggestions, feature requests, or want to contribute in any other way, please feel free to open an issue or submit a pull request.


For detailed instructions on developing, building, and publishing this package, please refer to the [README_DEV](https://github.com/c3di/im2im/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/im2im",
    "name": "im2im",
    "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/be/83/d351ceabc0c88aacc89d2e0b7b6073d0f5beb2ee9910cc54383382c1fe3b/im2im-0.0.3.tar.gz",
    "platform": "any",
    "description": "# im2im\r\n\r\n[![PyPI - Version](https://img.shields.io/pypi/v/im2im.svg)](https://pypi.org/project/im2im/)\r\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/im2im)](https://pypi.org/project/im2im/)\r\n[![Documentation](https://img.shields.io/badge/Doc-tutorial-blue)](https://github.com/c3di/im2im/blob/main/tutorial.ipynb)\r\n[![Tests](https://github.com/c3di/im2im/actions/workflows/python%20tests%20with%20coverage.yml/badge.svg)](https://github.com/c3di/im2im/actions/workflows/python%20tests%20with%20coverage.yml)\r\n[![codecov](https://codecov.io/github/c3di/im2im/graph/badge.svg?token=BWBXANX8W7)](https://codecov.io/github/c3di/im2im)\r\n\r\nThe `im2im` package provides an automated approach for converting in-memory image representations across a variety of image processing libraries, including `numpy`, `opencv-python`, `torch`, `PIL`, `Matplotlib.plt.imshow`, and `Tensorflow`. It handles the nuances inherent to each library's image representation, such as data formats (numpy arrays, PIL images, torch tensors, and so on), color channel (RGB or grayscale), channel order (channel first or last or none), device (CPU/GPU), and pixel intensity ranges.\r\n\r\n\r\nAt the core of the package is a knowledge graph, where each node encapsulates metadata detailing an image representation, and the edges between nodes represent code snippets for converting images from one representation to another. When converting from the source to the target, the `im2im` package identifies the shortest path within the graph,  it gathers all relevant conversion snippets encountered along the path. These snippets are then combined to formulate the final conversion code, which is subsequently employed to transform the source images into the desired target format.\r\n\r\n\r\n## Installation\r\n\r\nInstall the package via pip:\r\n```bash\r\npip install im2im\r\n```\r\n\r\n\r\n## Usage\r\n\r\nOne example from the image data in numpy to the image data in PyTorch:\r\n```python\r\nimport numpy as np\r\nfrom im2im import im2im\r\n\r\nsource = np.random.randint(0, 256, (20, 20, 3), dtype=np.uint8)\r\ntarget = im2im(source, {\"lib\": \"numpy\"}, {\"lib\": \"torch\", \"color_channel\":\"gray\", \"image_dtype\": \"uint8\"})\r\n```\r\n\r\nFor other APIs like `im2im_code`, and `im2im_path`, please refer to [tutorials](https://github.com/c3di/im2im/blob/main/tutorial.ipynb) or [public APIs](https://github.com/c3di/im2im/blob/main/src/im2im/interface_py_api.py).\r\n\r\n## Knowledge Graph Extension\r\n\r\nOur package is designed for easy knowledge graph extension. Once you are familiar with the mechanisms behind the construction of the knowledge graph, you can leverage a suite of functions designed for various extension requirements including `add_meta_values_for_image`, `add_edge_factory_cluster`, and `add_conversion_for_metadata_pairs`, each tailored for different extension needs. \r\n\r\n## Evaluation\r\n\r\n\r\n**Accuracy**\r\n\r\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/im2im/blob/main/tests/test_conversion_code_in_kg.py).\r\n\r\n**Performance profiling**\r\n\r\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/im2im/blob/main/profile).\r\n\r\n**Usability Evaluation**\r\n\r\nPlease refer to [Usability Evaluation](https://github.com/c3di/im2im_evaluation).\r\n\r\n## Contribution\r\n\r\nWe welcome all contributions to this project! If you have suggestions, feature requests, or want to contribute in any other way, please feel free to open an issue or submit a pull request.\r\n\r\n\r\nFor detailed instructions on developing, building, and publishing this package, please refer to the [README_DEV](https://github.com/c3di/im2im/blob/main/README_Dev.md).\r\n\r\n## Cite\r\n\r\nif you use our tool or code in your research, please cite the following paper:\r\n\r\nTodo\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the LICENSE file for details.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Automatically converting in-memory representations of images using a knowledge graph of type description.",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/c3di/im2im",
        "Source": "https://github.com/c3di/im2im/",
        "Tracker": "https://github.com/c3di/im2im/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "866da9979685bc158a646a13ddc57c3718cf2683b3568028b1833ff238d4c683",
                "md5": "d936b119d24b869eaa7c3dc155611e10",
                "sha256": "d1723e986011c7247c5616c02c03f891907dd6dcb5e5e90670976d87c31e99a4"
            },
            "downloads": -1,
            "filename": "im2im-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d936b119d24b869eaa7c3dc155611e10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.9",
            "size": 82738,
            "upload_time": "2024-04-10T18:10:51",
            "upload_time_iso_8601": "2024-04-10T18:10:51.408794Z",
            "url": "https://files.pythonhosted.org/packages/86/6d/a9979685bc158a646a13ddc57c3718cf2683b3568028b1833ff238d4c683/im2im-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be83d351ceabc0c88aacc89d2e0b7b6073d0f5beb2ee9910cc54383382c1fe3b",
                "md5": "70de2449c0d548b76fb9ff88e78afa2c",
                "sha256": "9acb6ded4ac61b67be21ccc4d13f19ad81fd63471433f0cf4f5496b22132b15d"
            },
            "downloads": -1,
            "filename": "im2im-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "70de2449c0d548b76fb9ff88e78afa2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.9",
            "size": 230047,
            "upload_time": "2024-04-10T18:10:53",
            "upload_time_iso_8601": "2024-04-10T18:10:53.847129Z",
            "url": "https://files.pythonhosted.org/packages/be/83/d351ceabc0c88aacc89d2e0b7b6073d0f5beb2ee9910cc54383382c1fe3b/im2im-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-10 18:10:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "c3di",
    "github_project": "im2im",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "im2im"
}
        
Elapsed time: 0.25533s