Git Product home page Git Product logo

real-time-style-transfer-opencv's Introduction

real-time-style-transfer-opencv

Hits License Stars Korean Posting

real_time_st

This project shows the streaming of open-cv by applying the style-transfer to the background (or person) except the person (or background) in real time using a web-cam connected to a laptop or computer.

  • Basic streaming function
  • Camera zoom function, capture function, video recording function
  • Style conversion function using Open-CV dedicated UI button
  • Provides a function to apply style (background-to-person) using icons

Style Transfer can be applied by using a pre-trained model or by training yourself. There are many sources and sites that provide the ability to convert images, but there are few sources that are easily applied in real time, and in order to realize a simple idea that applies only to backgrounds other than people, we need to customize it to start the project.

So we came up with this project.

Environment

real-time-style-transfer-opencv was developed using the following library version:

  • [Python3] - 3.7.4
  • [Tensorflow] - 2.0.0
  • [opencv-python] - 4.1.2.30

and [window 10] Environment

Installation

real-time-style-transfer-opencv require python3 v3+ and tensorflow v2+ to run.

Install the dependencies.

$ pip install opencv-python
$ pip intall tensorflow==2.0.0

Clone Repository...

$ mkdir project
$ cd project
$ git clone https://github.com/harimkang/real-time-style-transfer-opencv.git
$ cd real-time-style-transfer-opencv

Models

real-time-style-transfer-opencv requires a model that segmentes people and a style transfer model.

Model README
Style Transfer magnta/arbitrary-image-stylization-v1-256
People Segmentation [U-Net]

Start Project

Just Start:

$ python Camera.py

And Use Buttons and Icon:

image

  • Buttons: Click to switch the video to the painter's style. The button is blue in the On state and the photo in the Off state. Currently, there are Gogh, Kandinsky, Monet, Picasso, Na Hye-suk and Super Mario painting styles.
  • Icon: The icon is available when you are in Style Transfer (when a certain button is On), and if Style Transfer is applied only to the background, it is switched to apply to people other than the background. The reverse is also possible.

Customizing the code

  • Adding Style:
  1. Add the image of the style you want to add to the folder. image

  2. You can edit style_img in StyleTransfer class in style_transfer.py image

  3. Adding Button - In Button setting function of ButtonManager class in Button.py, you can add Button object like other buttons.

image

Below is an example of adding btn10.

btn10 = Button("Button's Name")
btn_list = [btn, btn2, btn3, btn4, btn5, btn6, btn7, btn10]
self.add_button_list(btn_list)

Examples

image image

To-do

  • FPS improvement

Blog Posting

Team

mevia

The project was conducted at the Korea Lab of Artificial Intelligence and formed a team called Mevia.

ezgif com-webp-to-png

License

MIT

From MEVIA

real-time-style-transfer-opencv's People

Contributors

harimkang avatar somsomdah 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.