Coder Social home page Coder Social logo

akashsdas / neural-style-transfer Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 23.33 MB

Neural Style Transfer implementation for images and videos using Tensorflow2.

License: Apache License 2.0

Jupyter Notebook 99.99% Python 0.01%
tensorflow2 neural-style-transfer images tensorflow-hub kaggle sobel-edge-detection total-variation-loss gradient-tape custom-model custom-loss-functions

neural-style-transfer's Introduction

neural-style-transfer

In this project Neural Style Transfer (NST) is used to style images and videos. The Neural Style Transfer for images is the notebook in which NST is applied on images, the Neural Style Transfer for videos is the notebook in which NST is applied on videos and Real time neural style transfer is the script which is used style video captured in real time.

Table of contents

Getting started

The neural-style-transfer-for-images and neural-style-transfer-for-videos are available on Kaggle to work in the same environment where this notebook was created i.e. use the same version packages used, etc... These notebooks uses GPU for faster computation.

The real-time-neural-style-transfer.py script can be executed like a normal python script. This script uses one video capture (webcam), so if no webcam is avialable then replace 0 value in cv2.VideoCapture method with video filename to apply on that video.

Neural Style Transfer for images

Neural Style Transfer (NST) is one of the most fun techniques in deep learning. It merges two images namely, a content image (C) and a style image (S), to create a generated image (G). The generated image G combines the content of the image C with the style of image S.

For example, let’s take an image of this turtle and Katsushika Hokusai's The Great Wave off Kanagawa:

Style transfer is an interesting technique that showcases the capabilities and internal representations of neural networks.

Results for Neural Style Transfer for images

Neural Style Transfer for videos

This is an naive implementation for applying neural style transfer for videos. Here neural style transfer is applied to every frame of the video and a new video is created with the applied style with the content of the original video. The way I've applied neural style transfer on a frame of the video is the same as we apply on a single image (since an individual frame is just an image).

For this project I've used the pre-trained model from Tensorflow Hub which will allow us to perform Fast Style Transfer, though custom models can be used but applying style to them will be quite time consuming as compared to the method used here.

The styled videos for this project are saved in this Kaggle kernel.

Real time neural style transfer

This one is very laggay and the reason for that is that this is a naive implementation where each and every NST is applied on each and every frame and that computation for styling a frame is what causes the lag but this is faster as compared to using custom models as here Fast Style Transfer is used.

Results for real time neural style transfer

License

APACHE LICENSE, VERSION 2.0

neural-style-transfer's People

Contributors

akashsdas avatar

Stargazers

 avatar

Watchers

 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.