im2im


Nameim2im JSON
Version 0.0.4 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-08-15 16:42:02
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: Automatically Converting In-Memory Image Representations using A Knowledge Graph Approach

[![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/)
[![Downloads](https://static.pepy.tech/badge/im2im)](https://pepy.tech/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 `scikit-image`, `opencv-python`, `scipy`, `PIL`, `Matplotlib.plt.imshow`, `PyTorch`, `Kornia` 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.

Im2im was developed for the use in Visual Programming Language for image processing (VPL4IPs) to completely removes the conversions steps required to manually manage image transformations, drastically improving accessibility, specifically for non-expert users. It also addresses the tension between low-level implementation details necessary for compatibility and the high-level image processing operations that VPL4IPs aim to provide. However, the library is a conventional Python package, and as such, it can also be used by directly invoking its functions from any Python image processing program to automate image conversion steps. Considering the relatively low memory footprint and computational overhead of the system, using the library to simplify conventional Python programming is an interesting option as well. 


## Installation

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


## Usage

```python
import numpy as np
from im2im import Image, im2im

# Assume an image that is a numpy.ndarray with shape (20, 20, 3) in uint8 format
to_be_converted = np.random.randint(0, 256, (20, 20, 3), dtype=np.uint8)

# Convert the image using the input preset "numpy.rgb_uint8" for the source image and "torch.gpu" for the target image.
converted: Image = im2im(Image(to_be_converted, "numpy.rgb_uint8"), "torch.gpu")
# Access the converted image data via 'converted.raw_image', which is now a torch tensor with shape (1, 3, 20, 20),
# in float32 format, normalized to the range [0, 1], and transferred to the GPU.
```

For other APIs like `im2im_code`, please refer to [public APIs](https://github.com/c3di/im2im/blob/main/src/im2im/api.py). 

For integration to visual programming language, please refer to [Comparative Analysis](https://github.com/c3di/im2im/blob/main/comparative_analysis).

## Evaluation

**Comparative Analysis**
The effectiveness and benefits for VPL4IPs are validated through [Comparative Analysis](https://github.com/c3di/im2im/blob/main/comparative_analysis). For detailed comparisons, please refer to the following studies: [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1cf5M1gOMdMXaRIKsCYalVj99RzMYSy8C?usp=sharing), [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1qPPL-IvovlhdKv-_0SjADBSOc60SPZDT?usp=sharing) and [third study](https://github.com/c3di/im2im/blob/main/comparative_analysis/3/Implementation_Comparison.pdf).

**Accuracy**
All conversion code snippets are thoroughly verified through [execution checks](https://github.com/c3di/im2im/blob/main/tests/test_conversion_code_in_kg.py) to ensure their correctness.

**Performance Profiling**
Performance is analyzed using the cProfile module, with detailed results available in the [profiling notebooks](https://github.com/c3di/im2im/blob/main/profile).

## 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

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/8c/74/f4f4e8a7d7f0deec1873acb4c17febc3a56d2e1d936ba5b3ca63549e68eb/im2im-0.0.4.tar.gz",
    "platform": "any",
    "description": "# im2im: Automatically Converting In-Memory Image Representations using A Knowledge Graph Approach\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[![Downloads](https://static.pepy.tech/badge/im2im)](https://pepy.tech/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 `scikit-image`, `opencv-python`, `scipy`, `PIL`, `Matplotlib.plt.imshow`, `PyTorch`, `Kornia` 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\nIm2im was developed for the use in Visual Programming Language for image processing (VPL4IPs) to completely removes the conversions steps required to manually manage image transformations, drastically improving accessibility, specifically for non-expert users. It also addresses the tension between low-level implementation details necessary for compatibility and the high-level image processing operations that VPL4IPs aim to provide. However, the library is a conventional Python package, and as such, it can also be used by directly invoking its functions from any Python image processing program to automate image conversion steps. Considering the relatively low memory footprint and computational overhead of the system, using the library to simplify conventional Python programming is an interesting option as well. \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\n```python\r\nimport numpy as np\r\nfrom im2im import Image, im2im\r\n\r\n# Assume an image that is a numpy.ndarray with shape (20, 20, 3) in uint8 format\r\nto_be_converted = np.random.randint(0, 256, (20, 20, 3), dtype=np.uint8)\r\n\r\n# Convert the image using the input preset \"numpy.rgb_uint8\" for the source image and \"torch.gpu\" for the target image.\r\nconverted: Image = im2im(Image(to_be_converted, \"numpy.rgb_uint8\"), \"torch.gpu\")\r\n# Access the converted image data via 'converted.raw_image', which is now a torch tensor with shape (1, 3, 20, 20),\r\n# in float32 format, normalized to the range [0, 1], and transferred to the GPU.\r\n```\r\n\r\nFor other APIs like `im2im_code`, please refer to [public APIs](https://github.com/c3di/im2im/blob/main/src/im2im/api.py). \r\n\r\nFor integration to visual programming language, please refer to [Comparative Analysis](https://github.com/c3di/im2im/blob/main/comparative_analysis).\r\n\r\n## Evaluation\r\n\r\n**Comparative Analysis**\r\nThe effectiveness and benefits for VPL4IPs are validated through [Comparative Analysis](https://github.com/c3di/im2im/blob/main/comparative_analysis). For detailed comparisons, please refer to the following studies: [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1cf5M1gOMdMXaRIKsCYalVj99RzMYSy8C?usp=sharing), [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1qPPL-IvovlhdKv-_0SjADBSOc60SPZDT?usp=sharing) and [third study](https://github.com/c3di/im2im/blob/main/comparative_analysis/3/Implementation_Comparison.pdf).\r\n\r\n**Accuracy**\r\nAll conversion code snippets are thoroughly verified through [execution checks](https://github.com/c3di/im2im/blob/main/tests/test_conversion_code_in_kg.py) to ensure their correctness.\r\n\r\n**Performance Profiling**\r\nPerformance is analyzed using the cProfile module, with detailed results available in the [profiling notebooks](https://github.com/c3di/im2im/blob/main/profile).\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. 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).\r\n\r\n## Cite\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.4",
    "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": "7cfff65fd70725368ec5a9dd9f77c2874acd2cf2b8ab105f57330a671332d677",
                "md5": "df63761fdaa954efa39be391186f5442",
                "sha256": "feb830c72b9194ad6dbea7aec47eb91c77c14d2f80f114e3f1d739f04bdf9d91"
            },
            "downloads": -1,
            "filename": "im2im-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "df63761fdaa954efa39be391186f5442",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.9",
            "size": 80746,
            "upload_time": "2024-08-15T16:42:00",
            "upload_time_iso_8601": "2024-08-15T16:42:00.943298Z",
            "url": "https://files.pythonhosted.org/packages/7c/ff/f65fd70725368ec5a9dd9f77c2874acd2cf2b8ab105f57330a671332d677/im2im-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8c74f4f4e8a7d7f0deec1873acb4c17febc3a56d2e1d936ba5b3ca63549e68eb",
                "md5": "c2f1cae5cc2f654bdfb75b468a301381",
                "sha256": "8f49b8c83a3a666fa85053b41128210365de625698e67e31219ff7f83d25175e"
            },
            "downloads": -1,
            "filename": "im2im-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "c2f1cae5cc2f654bdfb75b468a301381",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.9",
            "size": 2754535,
            "upload_time": "2024-08-15T16:42:02",
            "upload_time_iso_8601": "2024-08-15T16:42:02.863049Z",
            "url": "https://files.pythonhosted.org/packages/8c/74/f4f4e8a7d7f0deec1873acb4c17febc3a56d2e1d936ba5b3ca63549e68eb/im2im-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-15 16:42:02",
    "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.50003s