Deep learning superresolution in pure rust

Overview

Rusty_SR

LogoNNLogoLinLogo

A Rust super-resolution tool, which when given a low resolution image utilises deep learning to infer the corresponding high resolution image. Use the included pre-trained neural networks to upscale your images, or easily train your own specialised neural network!
Feel free to open an issue for general discussion or to raise any problems.

Usage

To upscale an image:
rusty_sr.exe <INPUT_FILE> <OUTPUT_FILE>

PNG output files are recommended.

For further options:
rusty_sr.exe --help
rusty_sr.exe train --help

Setup

To get the rust compiler (rustc) use rustup. For best performance compile using environmental variable RUSTFLAGS="-C target-cpu=native" and a release mode build cargo build --release.
Or in one line: cargo rustc --release -- -C target-cpu=native.

Examples

Set14 Cartoon
CartoonLowResCartoon

Set14 Butterfly
ButterflyLowResButterfly

Bank Lobby (test image for Neural Enhance)
CC-BY-SA @benarent
BankLowResBank

Note

Attemping to upscale images with significant noise or jpeg artefacts is likely to produce poor results. Input and output colorspace are nominally sRGB.

License

MIT

Comments
  • Could you share the parameters used for the README images?

    Could you share the parameters used for the README images?

    I haven't figured out how to get comparable results for the images on the README. If I run butterfly_nn.png with the imagenet parameters, I get a high-res (2304x1539) image that basically looks like a stretched image:

    before-and-after

    I've tried a few combinations of parameters with the different images from your README and seem to minor variations on the same results. I feel like I'm overlooking something. Any insights?

    opened by anowell 6
  • Hosted rusty_sr

    Hosted rusty_sr

    So I finally managed to get this live on Algorithmia: Algorithmia

    If you're interested in owning/maintaining it, I'm happy to help make that happen. Our process of transferring algorithms needs a bit of work, but for now, I have a mirror of the repo on github, so it should be possible to:

    1. Create a new rust algorithm yourself from the website
    2. Clone it: git clone https://git.algorithmia.com/git/USERNAME/ALGONAME.git
    3. Merge in my mirror (my git-fu here isn't beautiful):
    git add remote original https://github.com/anowell/enhance_resolution.git
    get fetch enhance_resolution
    git merge -s recursive -X theirs original/master --allow-unrelated-histories
    # fix algorithmia.conf and Cargo.toml to have your username & algoname
    
    1. Make sure it builds, and then push it
    2. Update description, publish it, add sample input, etc..
    3. Let me know, and I'll effectively hide my implementation from the marketplace and point it at your version

    (and feel free to just close this if you're not interesting in owning/maintaining it on Algorithmia)

    opened by anowell 4
  • rusty_sr seems to be stuck

    rusty_sr seems to be stuck

    Hi,

    And congrats for kicking off this great project and its underlying library.

    I tried with a random image of mine, but the process never completed. CPU usage topped to all cores being 100% busy, then dropped to 0 after a few minutes and then nothing happened any more. No output being generated either.

    rust-nightly (f80514426 2017-02-10), macOS.

    I just ran rusty_sr /tmp/tof-12637.jpg /tmp/yz.jpg.

    Input image attached: tof-12637

    opened by jedisct1 4
  • build error with cargo build

    build error with cargo build

    error[E0412]: cannot find type `BigInt` in this scope
       --> /home/moe/.cargo/registry/src/github.com-1ecc6299db9ec823/num-rational-0.1.37/src/lib.rs:671:30
        |
    671 | impl FromPrimitive for Ratio<BigInt> {
        |                              ^^^^^^ not found in this scope
    
       Compiling matrixmultiply_mt v0.1.1
    error: no associated item named `from_float` found for type `Ratio<_>` in the current scope
       --> /home/moe/.cargo/registry/src/github.com-1ecc6299db9ec823/num-rational-0.1.37/src/lib.rs:681:9
        |
    681 |         Ratio::from_float(n)
        |         ^^^^^^^^^^^^^^^^^
    
    error: no associated item named `from_float` found for type `Ratio<_>` in the current scope
       --> /home/moe/.cargo/registry/src/github.com-1ecc6299db9ec823/num-rational-0.1.37/src/lib.rs:685:9
        |
    685 |         Ratio::from_float(n)
        |         ^^^^^^^^^^^^^^^^^
    
    error: aborting due to 2 previous errors
    
    error: Could not compile `num-rational`.
    Build failed, waiting for other jobs to finish...
    error: build failed
    
    
    opened by alscientist 1
  • more details about train?

    more details about train?

    Nice to see your rust impl. I'd like to use it for 2X factor upscale. Can you provide more details about how to train the model? Or do you have any sample dataset or model for quick setup?

    opened by piaoger 9
Owner
zza
zza
🦀 Example of serving deep learning models in Rust with batched prediction

rust-dl-webserver This project provides an example of serving a deep learning model with batched prediction using Rust. In particular it runs a GPT2 m

Evan Pete Walsh 28 Dec 15, 2022
miniature: a toy deep learning library written in Rust

miniature: a toy deep learning library written in Rust A miniature is a toy deep learning library written in Rust. The miniature is: implemented for a

Takuma Seno 4 Nov 29, 2021
Open deep learning compiler stack for cpu, gpu and specialized accelerators

Open Deep Learning Compiler Stack Documentation | Contributors | Community | Release Notes Apache TVM is a compiler stack for deep learning systems. I

The Apache Software Foundation 8.9k Jan 4, 2023
Awesome deep learning crate

NeuroFlow is fast neural networks (deep learning) Rust crate. It relies on three pillars: speed, reliability, and speed again. Hello, everyone! Work o

Mikhail Kravets 70 Nov 20, 2022
Messing around with deep learning

Deep Learning Test Implementing deep learning in Rust using just a linear algebra library (nalgebra). The neural network (4 hidden layers, 32 neurons

Dmitry Zamkov 9 Jun 22, 2022
High performance distributed framework for training deep learning recommendation models based on PyTorch.

PERSIA (Parallel rEcommendation tRaining System with hybrId Acceleration) is developed by AI platform@Kuaishou Technology, collaborating with ETH. It

null 340 Dec 30, 2022
Deep learning at the speed of light.

luminal Deep learning at the speed of light. use luminal::prelude::*; // Setup graph and tensors let mut cx = Graph::new(); let a = cx.new_tensor::<R

Joe Fioti 3 Jul 25, 2023
Deep recommender systems for Rust

sbr An implementation of sequence recommenders based on the wyrm autdifferentiaton library. sbr-rs sbr implements efficient recommender algorithms whi

Maciej Kula 112 Dec 24, 2022
☁ Puff ☁ - The deep stack framework.

☁ Puff ☁ Python with an async runtime built-in Rust for GraphQL, ASGI, WSGI, Postgres, PubSub, Redis, Distributed Tasks, and HTTP2 Client. What is Puf

Kyle Hanson 290 Jan 8, 2023
Flexible, reusable reinforcement learning (Q learning) implementation in Rust

Rurel Rurel is a flexible, reusable reinforcement learning (Q learning) implementation in Rust. Release documentation In Cargo.toml: rurel = "0.2.0"

Milan Boers 60 Dec 29, 2022
Practice repo for learning Rust. Currently going through "Rust for JavaScript Developers" course.

rust-practice ?? Practice repo for learning Rust. Directories /rust-for-js-dev Files directed towards "Rust for JavaScript Developers" course. Thank y

Sammy Samkough 0 Dec 25, 2021
A Rust library with homemade machine learning models to classify the MNIST dataset. Built in an attempt to get familiar with advanced Rust concepts.

mnist-classifier Ideas UPDATED: Finish CLI Flags Parallelize conputationally intensive functions Class-based naive bayes README Image parsing Confusio

Neil Kaushikkar 0 Sep 2, 2021
A Rust machine learning framework.

Linfa linfa (Italian) / sap (English): The vital circulating fluid of a plant. linfa aims to provide a comprehensive toolkit to build Machine Learning

Rust-ML 2.2k Jan 2, 2023
Machine Learning library for Rust

rusty-machine This library is no longer actively maintained. The crate is currently on version 0.5.4. Read the API Documentation to learn more. And he

James Lucas 1.2k Dec 31, 2022
Machine learning crate for Rust

rustlearn A machine learning package for Rust. For full usage details, see the API documentation. Introduction This crate contains reasonably effectiv

Maciej Kula 547 Dec 28, 2022
A fast, safe and easy to use reinforcement learning framework in Rust.

RSRL (api) Reinforcement learning should be fast, safe and easy to use. Overview rsrl provides generic constructs for reinforcement learning (RL) expe

Thomas Spooner 139 Dec 13, 2022
Machine learning in Rust.

Rustml Rustml is a library for doing machine learning in Rust. The documentation of the project with a descprition of the modules can be found here. F

null 60 Dec 15, 2022
Rust based Cross-GPU Machine Learning

HAL : Hyper Adaptive Learning Rust based Cross-GPU Machine Learning. Why Rust? This project is for those that miss strongly typed compiled languages.

Jason Ramapuram 83 Dec 20, 2022
Machine Learning Library for Rust

autograph Machine Learning Library for Rust undergoing maintenance Features Portable accelerated compute Run SPIR-V shaders on GPU's that support Vulk

null 223 Jan 1, 2023