Giter Site home page Giter Site logo

Comments (6)

onefish51 avatar onefish51 commented on July 20, 2024 5

you can use the code from InstColorization/InstColorization.ipynb

from google.colab.patches import cv2_imshow
img_name_list = ['000000022969', '000000023781', '000000046872', '000000050145']
show_index = 1

img = cv2.imread('example/'+img_name_list[show_index]+'.jpg')
lab_image = cv2.cvtColor(img, cv2.COLOR_BGR2LAB)
l_channel, _, _ = cv2.split(lab_image)

img = cv2.imread('results/'+img_name_list[show_index]+'.png')
lab_image = cv2.cvtColor(img, cv2.COLOR_BGR2LAB)
_, a_pred, b_pred = cv2.split(lab_image)
a_pred = cv2.resize(a_pred, (l_channel.shape[1], l_channel.shape[0]))
b_pred = cv2.resize(b_pred, (l_channel.shape[1], l_channel.shape[0]))
gray_color = np.ones_like(a_pred) * 128

gray_image = cv2.cvtColor(np.stack([l_channel, gray_color, gray_color], 2), cv2.COLOR_LAB2BGR)
color_image = cv2.cvtColor(np.stack([l_channel, a_pred, b_pred], 2), cv2.COLOR_LAB2BGR)

cv2_imshow(np.concatenate([gray_image, color_image], 1))

from instcolorization.

wangerzi avatar wangerzi commented on July 20, 2024

I got the same problem when I run python test_fusion.py --name test_fusion --sample_p 1.0 --model fusion --fineSize 512 --test_img_dir example --results_img_dir results at colab.
I can only use the fineSize 256 to test the effect, the colorization is so great but the image was compressed and cropped.

from instcolorization.

ericsujw avatar ericsujw commented on July 20, 2024

Our model colorizes every instance in the image, so it would take large amount of vram, so colorizing small image and attach color channel onto original gray image (see the least block of colab notebook) would be one acceptable method to colorize high resolution image.

from instcolorization.

polojohn avatar polojohn commented on July 20, 2024

Hi,
Please forgive me re-asking the same questions, I'm not clear about the answer yet.

Your Git page and read-me have been easy to follow and I can get small square cropped color results from my PC, that look great, (thank you!)

I am aiming to get color pictures the same size (and ratio) as the original gray ones from my home PC. I think you are saying I would need a lot of memory on my GPU to do this and my 6GB GPU is not enough.

But I think you are saying there is away around this problem..... "so colorizing small image and attach color channel onto original gray image would be one acceptable method to colorize high resolution image."

Are there any steps you could share with me that I can use on my home PC to do this? Ive looked at the last block of code on the colab but have not been able to use this in my conda environment. Thanks.

from instcolorization.

Python1203 avatar Python1203 commented on July 20, 2024

from instcolorization.

jerrymatjila avatar jerrymatjila commented on July 20, 2024

I think it will be great if somehow the code suggested by @onefish51 be merged into the https://github.com/ericsujw/InstColorization/blob/master/test_fusion.py

from instcolorization.

Related Issues (20)

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.