Code Monkey home page Code Monkey logo

imagecolorization's Introduction

Image and video colorizer

Image and video colorizer is package for automatic image and video colorization. Models are already trained.

Instalation

Installation can be done in 5 easy steps

  1. Install all requirements for Tensorflow and tensorflow itself with:

    pip install tensorflow-gpu
    

    if you use GPU device for computation otherwise:

    pip install tensorflow
    
  2. Create virtual environment

    virtualenv -p python3 colorization_venv
    
  3. Activate virtual environment

    source colorization_venv/bin/activate
    
  4. Clone Image and video colorization package and move in it

    git clone https://github.com/PrimozGodec/ImageColorization.git
    cd ImageColorization
    
  5. Install requirements

    pip install -r requirements.txt
    
  6. You are done :)

In case you do not have a GPU device in your computer, please install Tensorflow for a CPU. Instructions are at the Tnesorflow website.

Image colorization

For automatic image colorizing follow those steps:

  1. Copy images into /data/image/original directory

  2. Run main.py script from src/image_colorization/ directory.

    python -m src.image_colorization.main --model <model name>
    

    Parameter --method is optional, if not present reg_full_model is default. It can be choose from this list:

    • reg_full_model (default)
    • reg_full_vgg_model
    • reg_part_model
    • class_weights_model
    • class_wo_weights_model
  3. You can find colored images in /data/image/colorized directory.

on your GPU or CPU specifications. You will see progress bar that show you how far you are with colorization.

Video colorization

For automatic video colorizing follow those steps:

  1. Copy images into /data/video/original directory

  2. Run video_colorizer.py script from src/video_colorization/ directory.

    python -m src.video_colorization.video_colorizer
    

    Video colorizer is always using reg_full_model.

  3. You can find colored videos in /data/video/colorized directory.

Colorization take few hours since there is a lot of images to color in a video and depends on your GPU or CPU specifications and length of a video. You will see progress bar that show you how far you are with colorization.

imagecolorization's People

Contributors

primozgodec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

imagecolorization's Issues

Train script and other details

Hello! I went through your repo and found it very useful. I wanted to inquire if you could also provide the script for training, the model script and indicate what type of data are the pre-trained models trained on. Thanks a lot!

video colorization

Hi.
Thanks in advance.
I tried to run video colorization code and i'm getting the following error.

image

A video is saved in temp directory but i'm not able to run it.

video

Hello, I'm sorry to bother you, but I encountered the following problems when I was dealing with the video:
2020-07-15 12-03-57屏幕截图

Moreover, the MP4 file generated cannot be opened. May I ask why?
Thank you for your reply.

Issue

Hi

thanks. having some issues

  1. Unable to run src.image_colorization.main, complains that src can't be found
  2. and for running the main.py for images, what should be indicated in

HTTP Error : Error 404

While I am running the code, I got an error.

data/weights/imp9-full.h5
Downloading trained model
Traceback (most recent call last):
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Dhanya\Downloads\ImageColorization-master\ImageColorization-master\src\image_colorization\main.py", line 21, in
model.load_weights(get_weights(imported_model.weights))
File "C:\Users\Dhanya\Downloads\ImageColorization-master\ImageColorization-master\src\utils\image_utils.py", line 92, in get_weights
reporthook=show_progress)
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\urllib\request.py", line 248, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\urllib\request.py", line 532, in open
response = meth(req, response)
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\urllib\request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\urllib\request.py", line 570, in error
return self._call_chain(*args)
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "C:\Users\Dhanya\Anaconda3\envs\tensorflow\lib\urllib\request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Also the url provided in the image_utils.py file is not available.
https://github.com/PrimozGodec/ImageColorization/releases/download/v0.0.1

invalid argument

size of the video file in temp and the original video is different thats why invalid argument error occurs what to do to solve this issue

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.