PIL × DAT - Pillow extension for AI-based image upscaling.
Installation
For PyPI:
pip install pillow-dat
For Poetry:
poetry add pillow-dat
Get started
from PIL.Image import open
from PIL_DAT.Image import upscale
lumine_image = open(".github/lumine.png")
lumine_image = upscale(lumine_image, 2)
Remark: We strongly advocate for the utilization of DAT light models owing to their streamlined design and outstanding speed performance. However, should you opt for alternative models, please note that *.pth model weights can be accessed via Google Drive.
Example
| Input (lumine.png) | DAT light (x2) | Bicubic (x2) |
|---|---|---|
Benchmarks
Speed
Performance benchmarks have been conducted on a computing system equipped with an Intel(R) CORE(TM) i7-9750H CPU @ 2.60GHz processor, accompanied by a 2 × 8 Go at 2667MHz RAM configuration. Below are the recorded results:
| In seconds | 320 × 320 | 640 × 640 | 960 × 960 | 1280 × 1280 |
|---|---|---|---|---|
| DAT light (x2) | 16.1 | 65.3 | 146.8 | 339.8 |
| DAT light (x3) | 14.3 | 61.7 | - | - |
| DAT light (x4) | 14.0 | 63.0 | - | - |
The results were compared against the renowned OpenCV library, utilizing its EDSR model known for delivering superior image quality.
| In seconds | 320 × 320 | 640 × 640 | 960 × 960 | 1280 × 1280 |
|---|---|---|---|---|
| EDSR (x2) | 25.6 | 112.9 | 264.1 | 472.8 |
| EDSR (x3) | 24.3 | 112.5 | - | - |
| EDSR (x4) | 23.6 | 111.2 | - | - |
Remark: All benchmark results presented here are reproducible. For detailed implementation, please refer to the following files: benchmark_speed_dat_light.py and benchmark_speed_edsr.py.
Quality
| DAT light (x2) | EDSR (x2) |
|---|---|
Remark: All benchmark results presented here are reproducible. For detailed implementation, please refer to the following files: example.py and benchmark_quality_edsr.py.
Alpha-channel-awareness
| Input | DAT light (x2) | EDSR (x2) |
|---|---|---|
Remark: All benchmark results presented here are reproducible. For detailed implementation, please refer to the following files: benchmark_alpha_channel_awareness_dat_light.py and benchmark_alpha_channel_awareness_edsr.py.
Contribution
Please install Python.
Please install Poetry via pipx.
Please install VSCode and its extensions:
- Black Formatter
- isort
- Python
- Pylance
- Even Better TOML
To have your Python environment inside your project (optional):
poetry config virtualenvs.in-project true
To create your Python environment and install dependencies:
poetry install
To run unit tests:
pytest
To publish package:
poetry publish --build -u __token__ -p <pypi_token>
Acknowledgement
This library is founded upon the pioneering research paper, "Dual Aggregation Transformer for Image Super-Resolution".
@inproceedings{chen2023dual,
title={Dual Aggregation Transformer for Image Super-Resolution},
author={Chen, Zheng and Zhang, Yulun and Gu, Jinjin and Kong, Linghe and Yang, Xiaokang and Yu, Fisher},
booktitle={ICCV},
year={2023}
}
Release files for pillow-dat 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pillow_dat-0.1.11.tar.gz | 7.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pillow_dat-0.1.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.3 MB
Release files / pillow_dat-0.1.11.tar.gz
| Download URL | pillow_dat-0.1.11.tar.gz |
|---|---|
| Size | 7.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2c7be71502b97b4082765595ee427dd5c48c83a6d09e92e99f108669a6ea72b
|
|
BLAKE2b-256 checksum How to use checksums |
b4c9b015a569116a6dae0f747cadaca348e4b861458e58737e3dac5a1808433f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.2 Windows/11
|
Release files / pillow_dat-0.1.11-py3-none-any.whl
| Download URL | pillow_dat-0.1.11-py3-none-any.whl |
|---|---|
| Size | 7.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c0504a3cef51bed486352ae3b3e996935955186792d9f4eeeb875a63afdc087
|
|
BLAKE2b-256 checksum How to use checksums |
36df4f33885ddd03268640aeb7dbb10afcb0ee3f0bded118d0ac16596874f27b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.2 Windows/11
|