Git Product home page Git Product logo

neuralnetwork-jpeg's Introduction

Convolutional Neural Network (CNN) Image Compression

Encode/decode natural images using Neural Network.

Motivation :

That said, a research paper must include some original contributions, introducing novel ideas and proving its validity and improved performance. In fact, writing a research paper is the culmination of an intense dedication to research, having analysed different hypothesis and assessed their appropriateness.

Goals :

  • use different image compression techniques to get compressed images
  • compare different image enhancement algorithms
  • purposed own algorithm
  • compare it to other alogorithms

Status

Work in progress --updated by Suman kunwar

Try it out

$ cd npeg
$ ipython -i train.py

then type in one of the following commands:

# strong noise training (should converge to 0.0008 loss)
for i in range(5):
    r(cnoise=15.0)

# weak noise pretraining (no difference in final loss)
for i in [0.1, 0.3, 1.0, 5.0, 15.0]:
    r(cnoise=i)

# save weights to file
save()

# load weights from file
load()

# test model on randomly sampled CIFAR
show()

Dependencies:

  • TensorFlow r1.0
  • Canton library: pip install canton
  • Keras (mainly for downloading CIFAR)

If you need visualization functionality:

  • cv2 (install via conda is recommended)
  • cv2tools (pull from https://github.com/ctmakro/cv2tools then pip install -e <dirname>)
  • or modify the code to use other visualization libraries you prefer

How it works

CNN Image Compression - Neural Network Image Compression:https://sumn2u.github.io/neuralnetwork-jpeg

Training:

  • image -> Encoder CNN -> features
  • features += gaussian noise
  • features -> sigmoid -> code
  • code -> Decoder CNN -> reconstruction
  • loss = mean((image-reconstruction) ** 2) + mean(code**2) * 0.01

To reduce reconstruction loss, the best encoding strategy for the encoder is to drive its output ("features") large, to reduce artifacts caused by the gaussian noise.

Therefore by increasing the magnitude of the gaussian noise, the code will eventually saturate to 0 or 1.

We encourage sparsity of the code (to allow for further compression) by adding a penalty term (mean(code**2) * 0.01), after which the code will tend to include more zeros and less ones.

Testing:

  • image -> Encoder CNN -> features
  • features -> sigmoid -> binary quantization -> code
  • code -> Decoder CNN -> reconstruction

About

Original Author: Qin Yongliang and Suman Kunwar

License: MIT

neuralnetwork-jpeg's People

Contributors

sumn2u avatar

Stargazers

S R Ashuwanthh avatar  avatar  avatar  avatar  avatar  avatar Arcane avatar 何熠辉 avatar  avatar

Watchers

 avatar Kostas Georgiou avatar  avatar

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.