Skip to content

Repository files navigation

Potato AI logo

Potato AI

On-device AI super-resolution, built to be measured.

An experimental Android laboratory for validating image enhancement quality, stability, compatibility, and real-device performance.

Android 7+ Kotlin Jetpack Compose ONNX Runtime Offline MIT License

PurposePipelineModel creditBuildBenchmarking


Why Potato AI exists

Super-resolution can look impressive in a desktop demo and still fail on a real phone because of static tensor shapes, limited memory, slow inference, thermal throttling, or enormous output allocations. Potato AI makes those constraints visible before the model is integrated into another application.

It is deliberately focused: select an image, enhance it, inspect the result, and measure what happened. This is a testing instrument—not a consumer photo editor.

Highlights

Capability What it provides
🧠 On-device inference Reusable ONNX Runtime session with no cloud dependency
🧩 Full-image processing Aspect-ratio-preserving block pipeline for static 128×128 model input
📈 Live benchmark data Load, inference, total time, progress, ETA, and block count
↔️ Visual validation Zoomable original/enhanced reveal comparison
🛑 Controlled execution Background continuation and safe stop after the active model call
💾 Memory-aware export Streamed lossless PNG output to Pictures/PotatoAI
🔒 Private by design No internet permission, telemetry, upload, or remote processing

Available output targets are 1.25×, 1.5×, 2×, 3×, and 4×. The selected scale and theme persist across sessions.

How it works

Gallery image
    ↓ decode + orientation
Aspect-ratio-preserving source
    ↓ divide into model-sized regions
Real-ESRGAN x4plus via ONNX Runtime
    ↓ crop boundary blocks + stream scanlines
Lossless merged PNG
    ↓
Interactive comparison + automatic gallery export

Model ownership and credit

Important

Potato AI did not create, train, or own the Real-ESRGAN model. Full credit for Real-ESRGAN and the original x4plus model belongs to Xintao Wang and the Real-ESRGAN contributors. This repository only provides an independent Android/ONNX Runtime integration, block-processing pipeline, benchmark UI, and export workflow around that model.

The upstream project identifies RealESRGAN_x4plus as its general-image 4× model in the official model zoo. The research was published as Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data by Xintao Wang, Liangbin Xie, Chao Dong, and Ying Shan.

The upstream Real-ESRGAN project is released under the BSD 3-Clause License. That license permits source and binary redistribution, with or without modification, provided its copyright notice, license conditions, and disclaimer are retained. It also prohibits using the copyright holder's or contributors' names to endorse this project without permission. Potato AI preserves the required notice in THIRD_PARTY_NOTICES.md and does not claim upstream affiliation or endorsement.

The bundled .onnx file is a pre-converted artifact based on Real-ESRGAN x4plus. It was not produced or published as an official ONNX export by this repository, and Potato AI does not claim authorship of the graph or weights. Its exact checksum and inspected tensor contract are recorded in MODEL_CARD.md.

Model contract

The bundled model is Real-ESRGAN-x4plus.onnx.

Property Value
Input name image
Input type FLOAT
Input shape 1 × 3 × 128 × 128
Output name upscaled_image
Output type FLOAT
Output shape 1 × 3 × 512 × 512
Native model scale

The model has a static input shape. Potato AI divides the requested output into blocks, runs each source region through the native 4× model, crops edge blocks, and streams the merged PNG to disk. Lower output-scale options alter the sampled source region for each native model pass; they do not repeatedly resize a completed 4× image back down.

See MODEL_CARD.md for provenance, checksum, behavior, and limitations.

Requirements

  • Android Studio compatible with Android Gradle Plugin 9.1.1
  • JDK 17 or newer for Gradle
  • Android SDK 36.1
  • Android device or emulator running Android 7.0 (API 24) or newer

Real hardware is strongly recommended for meaningful benchmark results.

Build

  1. Clone the repository.
  2. Open it in Android Studio.
  3. Allow Gradle to sync.
  4. Run the app configuration on a device.

Command-line verification:

./gradlew :app:assembleDebug :app:testDebugUnitTest :app:lintDebug

The debug APK is generated at:

app/build/outputs/apk/debug/app-debug.apk

No API keys, network services, or external model downloads are required.

Architecture

Compose UI
  └── BenchmarkViewModel (StateFlow)
      └── BenchmarkRepository
          ├── ONNX Runtime engine
          ├── block-based image processor
          ├── streaming PNG writer
          └── MediaStore image saver

Packages are separated by responsibility:

  • ai — model contract validation and reusable ONNX Runtime session
  • data — orchestration and benchmark aggregation
  • image — decoding, block processing, and streaming PNG output
  • model — immutable application state and metrics
  • ui — Compose screens and ViewModel
  • util — foreground processing and image export

The processing interface intentionally leaves room for alternate processors, execution providers, benchmark metrics, and additional models.

Benchmark guidance

  • Use the same source image and scale when comparing devices.
  • Close unrelated heavy applications before a controlled benchmark.
  • Run multiple passes; the first pass includes model initialization and device warm-up effects.
  • Keep sufficient free storage for lossless PNG staging and export.
  • Thermal throttling, available memory, Android version, and CPU implementation can materially affect results.

The displayed timings are diagnostic values, not standardized hardware scores.

Known limitations

  • Inference currently uses ONNX Runtime CPU execution.
  • Native ONNX inference cannot be interrupted mid-call; Stop completes after the current block returns.
  • Lossless high-resolution PNG output can require substantial storage.
  • Very large outputs can still fail when device storage or memory is constrained.
  • AI restoration may invent texture or alter fine details; output is not a faithful reconstruction of missing information.
  • Benchmark results are not directly comparable across different app/model versions.

Privacy

Images remain on the Android device. Potato AI has no internet permission and does not upload images, telemetry, benchmark data, or device information.

Contributing

Focused bug reports and pull requests that improve benchmarking, correctness, compatibility, or performance are welcome. Please include relevant device, Android version, input dimensions, scale, and sanitized logs when reporting a problem.

License and attribution

Only the original Potato AI application source code is licensed under this repository's MIT License. That license does not replace or remove the separate terms that apply to bundled third-party components.

Real-ESRGAN/model attribution, ONNX Runtime, and the Inter font remain subject to their respective licenses and notices. See THIRD_PARTY_NOTICES.md.

Potato AI is an independent experimental project and is not affiliated with or endorsed by the Real-ESRGAN or ONNX Runtime maintainers.

About

A lightweight experimental AI image enhancement project.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages