Skip to main content

A high-quality image upscaling package using a genetically-evolved algorithm.

Project description

SHINKA Upscaler

This repository provides a Python API for high-quality image upscaling using a specialized, genetically-evolved algorithm. The upscaler is designed for both grayscale and color images, and can be used as a drop-in replacement for traditional interpolation-based upscaling methods.

Features

  • Upscales images by a specified factor (e.g., 2x, 4x)
  • Supports input as file path, PIL Image, or NumPy array
  • Outputs as PIL Image or NumPy array
  • Optionally saves the upscaled image to disk

Benchmark Results

SHINKA demonstrates state-of-the-art perceptual quality on real-world images. In a benchmark on 1,000 images from the takara-ai/image_captions dataset, SHINKA achieved the highest SSIM (Structural Similarity Index) among common upscaling methods:

Method SSIM PSNR (dB)
SHINKA 0.9459 35.32
Lanczos 0.9432 36.07
Bicubic 0.9376 35.54
Bilinear 0.9206 34.16
Nearest 0.9145 32.01

How to Use

Installation

Install from PyPI:

pip install shinka

Basic Usage

from shinka import upscale

# Upscale an image from file and save the result
result = upscale("input.jpg", scale=2, save_path="upscaled.png")

# Upscale a NumPy array and get a PIL Image
import numpy as np
from PIL import Image
arr = np.array(Image.open("input.jpg"))
result = upscale(arr, scale=2, output_type="PIL")

# Upscale and get a NumPy array
result = upscale("input.jpg", scale=2, output_type="np")

Command-Line Example

A minimal test script is provided:

# test_shinka.py
from shinka import upscale

upscale("DSC00183.jpeg", scale=4, save_path="test_evolved_upscaled.png")
print("Saved test_evolved_upscaled.png")

How the Algorithm Was Created

The upscaling algorithm was developed using a genetic optimization process. A population of image processing pipelines was evolved over multiple generations to maximize perceptual quality (measured by SSIM and sharpness) on a diverse set of images. The best-performing pipeline was selected and implemented in shinka for efficient, non-ML upscaling.

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shinka-0.1.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shinka-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file shinka-0.1.2.tar.gz.

File metadata

  • Download URL: shinka-0.1.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for shinka-0.1.2.tar.gz
Algorithm Hash digest
SHA256 170f91a22c2ab798e59e4abee604b47cd3adcecbee3e07673c8379971f94c83e
MD5 9d098369e0f1425886f2406bc41afc07
BLAKE2b-256 eee7d36fd62d121c4715b10a0a0c913646d3e8a51e080a09d0033efc00aa4400

See more details on using hashes here.

File details

Details for the file shinka-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: shinka-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for shinka-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f298707a89b9ea6157024ce446639e38a07ab9dea818ab943d4f735f8cab0583
MD5 0b94a75e3f578d78bd1f1d9eaf0639e7
BLAKE2b-256 dd5ab92bf4e5bf2aab402e2a7660a8ed2a701849550e076ec0021cb833f078c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page