luanfujun / deep-painterly-harmonization

Code and data for paper "Deep Painterly Harmonization": https://arxiv.org/abs/1804.03189
6.07k stars 626 forks source link

a working 2022 colab! #63

Closed eyaler closed 2 months ago

eyaler commented 2 years ago

You guys asked for it! building on @marcduda 's efforts, here is a 2022 fully working colab with minimal GUI. it can also calculate the mask for you - just upload the naive and target images and play with the style weight (as the wikiart predictor was never released afaiu). https://colab.research.google.com/gist/eyaler/5303782669fb43510d398bd346c6e3e6/deep-painterly-harmonization.ipynb

heartlocket commented 2 years ago

Thanks for sharing this. However the upload image button seems broken to me.

Also, when I try replacing the sample images with my onw, i run into this error: error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

any idea?

eyaler commented 2 years ago

works for me. this error may be due to manual upload of files that was not complete

Jelle50 commented 9 months ago

Has anyone managed to solve this? I get the same problem while running this in google colab. Even if I use the exact same input data from the examples it doesn't do anything.

It has problems running the "final_im = cv2.imread(final)" line because there is no final file to read. In this case it would be "results/rushmore_final_res.png". But the results folder is completely empty.

Cecover commented 2 months ago

This does not work. final_im requires an image to be saved and later read but since there aren't any, the code would throw an error.

Assuming the final_im is from dilated_im also causes more problems down the road.

eyaler commented 2 months ago

on jan 2023 google updated colab from ubuntu 18 to 20 and later to 22. these are not supported by cuda 10 so i dont have an easy way to fix this