Code Monkey home page Code Monkey logo

dqr's Introduction

DQR: A high-density QR code powered with deep learning

Logo

About the project

A lossless, RGB, QR encoder and decoder built with convolutions and a custom deconvolution.

It achieves a significant density increase over traditional QR codes as it can be seen in the next image:

Comparison between qr and dqr

Both matrix barcodes encode the same amount of data (220 bytes), but the DQR occupies less than 1/9th of the pixels that the traditional QR does.

Clarifications

  • Q: By relying on RGB doesn't that make it less reliable and sensible to noise?

A: Though it uses the whole RGB spectrum to encode data, it's actually robust to variations as it works with ranges of colors rather than specific color values. By training the network with noisy data, you can guarantee a certain noise tolerance.

  • Q: How is it lossless? If neural networks always have errors

A: Yes, neural networks have errors, however, by minimizing the L1 loss (MAE) between the decoded and the target tensors until it reaches errors of less than 1e-3, you can have a very high certainty that when the decoded tensor is converted to 1s and 0s, there's no resulting error.

This can be verified by testing the model, which measures exact match between the decoded and target binary strings. You should obtain an accuracy of 100% over a significant test set.

Usage

Install requirements with pip install -r requirements.txt.

Train with python train.py, this will save an encoder and decoder model that you can then use with python encode.py file_path and python decode.py file_path out_name.

To use the pretrained model, remove the .3x from the models at the models folder

TO-DOs

  • Increase downscaling multiplier. Currently at 3x.
  • Test/improve tolerance to noise.
  • Improve determining whether the model is lossless or not.
  • Train for decoding with mobile cameras.
    • Implement position, alignment and timing patterns, though the network might discover that by itself.

For fun

This whole README is encoded in the following DQR code.

Logo

And decoding it yields the same text back, as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.