CartoonGAN-Test-Pytorch-Torch
CartoonGAN-Test-Pytorch-Torch copied to clipboard
Can this code work on CPU?
--gpu -1
@Yijunmaverick I set the gpu -1 as you say,but the result image i got is unreasonable.The grayscale value of output image is all around 0.5,and as a result, the output image is gray.Do you have some suggesstions? I use a 8G cpu on Alibaba Cloud with torch.
Emm...not sure about your case. I just test it on my PC and the result is good.
My CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
@Yijunmaverick Thanks very much! If there are some reasons you think may result in such case,please tell me,i will be extremely appreciated. because this problem troubled me for a real long time.Thanks again.
Not familiar with Alibaba Cloud. Can you try it on a local regular desktop (with Ubuntu)? You may use a small image size if the CPU memory is limited.
Can you post your results here?
@Yijunmaverick I use pictures size 256*256,and only change the parameter of gpu and picture paths,it can work though comes out undesired results. Got information below.
[admin@izwz9gqe9a9t5dpaseck9cz CartoonGAN-Test-Pytorch-Torch]$ th test.lua -input_dir /usr/develop/img/input/ -style Hosoda -gpu -1 CPU mode Extracting image paths: /usr/develop/img/input/ /usr/develop/img/input/2016-06-13_20_48_43.jpg Done!
input picture and output picture are in file.
@Yijunmaverick Thanks very much! I will try!
@Yijunmaverick It doesn't work on my desktop computer, the result i got is the same.And i reinstalling the nn package,it also doesn't work. Sad. I want to check something. After cloning your code,i comment out some lines,
--require 'cutorch'require 'nn' --require 'cunn' require 'image' require 'nngraph' require 'paths' require 'src/InstanceNormalization
and change the parameters of gpu and paths.
local cmd = torch.CmdLine() --cmd:option('-input_dir','test_img','the path of input') cmd:option('-input_dir', '/usr/develop/img/input'); --cmd:option('-output_dir','test_output','the path of output') cmd:option('-output_dir', '/usr/develop/img/output', 'Path to save stylized image.') cmd:option('-load_size', 256) cmd:option('-gpu', -1, '-1 for CPU mode') cmd:option('-model_path', './pretrained_model/') cmd:option('-style', 'Hosoda')
If there are other things i need to do or something i make mistakse?
the code can work in the cpu,may be you need more Menmory