junyanz / interactive-deep-colorization

Deep learning software for colorizing black and white images with a few clicks.
https://richzhang.github.io/ideepcolor/
MIT License
2.69k stars 447 forks source link

gpu [GPU_ID]??? Interactive Deep Colorization windows 10 64-bit #75

Open HoaBi11 opened 4 years ago

HoaBi11 commented 4 years ago

Hello!

I want to use Interactive Deep Colorization but I can't run the command line below to run the UI

           python ideepcolor.py --gpu [GPU_ID] --backend [CAFFE OR PYTORCH]

I don't know [GPU_ID] is what.

I use windows 10 64-bit.

I use Pytorch.

How can I find GPU ID?

Thank you for your support!

icolor

HoaBi11 commented 4 years ago

Can I run the command line in CPU mode with Pytorch? If yes, how to do it?

I don't have Nvidia GPU so can't run the command line in GPU mode.

junyanz commented 4 years ago

You can add a flag --cpu_mode. It will work but it will be quite slow. If you just want to colorize your photo on Windows platform. you can use Adobe PSE. See this blog.

HoaBi11 commented 4 years ago

Maybe I have to try again with caffe! (-_-)

image

HoaBi11 commented 4 years ago

Thank you for your answer!

I realy realy like this project of you. (^_^)

I don't have any knowledge on programming so it's so hard to install for me.

HoaBi11 commented 4 years ago

Can you help me, junyan!

image

junyanz commented 4 years ago

Maybe you want to double-check if the image test_imgs/mortar_pestle.jpg is in your directory. Maybe you need to rename the file according to Windows format.

HoaBi11 commented 4 years ago

Thank you for that!

But I don't know I should do what, filename default was correct format.

Images

junyanz commented 4 years ago

I am not familiar with the Windows file path format. You should just go to python, and then debug the function cv2.imread. If you are not familiar with Python, you can use PSE directly.

python
import cv2
img=cv2.imread("your_test_image_path")
alex-montano commented 4 years ago

I'm using windows too, I had to change it as you said in gui_draw.py and colorize_image.py im = cv2.cvtColor(cv2.imread("./test_imgs/mortar_pestle.jpg"), cv2.COLOR_BGR2RGB) im_bgr = cv2.imread("./test_imgs/mortar_pestle.jpg")

But when I run it to show the UI, it just doesn't appear anything, and without errors:

(base) C:\Users\user\Documents\ideepcolor>python ideepcolor.py --gpu 0 --backend pytorch [win_size] = 512 [image_file] = test_imgs/mortar_pestle.jpg [gpu] = 0 [cpu_mode] = False [color_prototxt] = ./models/reference_model/deploy_nodist.prototxt [color_caffemodel] = ./models/reference_model/model.caffemodel [dist_prototxt] = ./models/reference_model/deploy_nopred.prototxt [dist_caffemodel] = ./models/reference_model/model.caffemodel [color_model] = ./models/pytorch/caffemodel.pth [backend] = pytorch [pytorch_maskcent] = False [load_size] = 256 ColorizeImageTorch instantiated path = ./models/pytorch/caffemodel.pth Model set! dist mode? False ColorizeImageTorch instantiated path = ./models/pytorch/caffemodel.pth Model set! dist mode? True b'test_imgs/mortar_pestle.jpg' scale = 2.000000 (base) C:\Users\user\Documents\ideepcolor>

And only using gpu 0, if I use gpu 1, I got an error of tensors weight. I had to say that in jupyter notebook, it works fine removing the comments of cuda(), but my problem is to run the UI

junyanz commented 4 years ago

Not sure. If you only have one GPU, you should use gpu 0. You can also try cpu model with --cpu_mode.

alex-montano commented 4 years ago

Thank you for the response. I have 2 GPU, but I can't open de UI, and I got no errors, as I said before.

nikhilwoodruff commented 4 years ago

@HoaBi11 , @amontanoa I just got that error (imread failing) - if it helps, I got around it by adding:

image_file = image_file.decode("utf-8") before imread is called, since the image filepath is in binary format. That got the UI showing, but doesn't seem to update once colour points are added though...