Closed kasarampavan closed 1 year ago
Thank you for your reply, I tried but it is not working...
By running the following command,
python style_transfer.py --content ./data/content/test.jpg --style arcane --name arcane_transfer --style_id 6 \
--weight 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 1 1 1 1 1 1 1 --align_face --preserve_color --wplus
I got the result (input / reconstructed by w+ / stylization result)
Can you get this result with the same command? If so, then it might be you modified some code that incurs the problem.
Thank you for response,I will modify and check the result
@williamyang1991
I tried with W+ Encoder but its giving error, can you check check once what I need to change here? here is a code snippet.
Error is coming on this lineπ
model_path = os.path.join(MODEL_DIR, 'encoder_wplus.pt') ckpt = torch.load(model_path, map_location='cpu') opts = ckpt['opts'] opts['checkpoint_path'] = model_path opts = Namespace(**opts) opts.device = device encoder = pSp(opts) encoder.eval() encoder = encoder.to(device)
ERROR Stack trace
AttributeError Traceback (most recent call last)
/DualStyleGAN/model/encoder/psp.py in init(self, opts) 24 self.set_opts(opts) 25 # compute number of style inputs based on the output resolution ---> 26 self.opts.n_styles = int(math.log(self.opts.output_size, 2)) * 2 - 2 27 # Define architecture 28 self.encoder = self.set_encoder()
AttributeError: 'Namespace' object has no attribute 'output_size'
In error its mentioned that 'output size' attribute is not in encoder.
Pls look once in this issue...
Please compare the code carefully before making any modification. I'm busy with a new project and don't have much time to debug for you.
Thanks i got it, what was the problem coming.. @williamyang1991
hey @williamyang1991
one more question how these weights are working...
example how can we manage weights for perfect output
` results = [] for i in range(6): # change weights of structure codes for j in range(6): # change weights of color codes w = [i/5.0]11+[j/5.0]7
img_gen, _ = generator([instyle], exstyle[0:1], z_plus_latent=True,
truncation=0.7, truncation_latent=0, use_res=True, interp_weights=w)
img_gen = torch.clamp(F.adaptive_avg_pool2d(img_gen.detach(), 128), -1, 1)
results += [img_gen]
vis = torchvision.utils.make_grid(torch.cat(results, dim=0), 6, 1) plt.figure(figsize=(10,10),dpi=120) visualize(vis.cpu()) plt.show()`
w has 18 elements, each corresponds to one layer of StyleGAN. w[i]=0 means the i-th layer use no stylization, and w[i]=1 means full stylization From 1st layer to 18th layer, the style is about from high-level structure to low-level color and texture. You can adjust w[i] to adjust the style at the i-th layer level
for details, please read our paper
after adding w+ encoder you changed the w , eg 0.6 is 11 times and 1 is 7 times. why?
this is just an example. Z+ encoder can also use this w.
please read README
so you mean we can do experiments with the weight, to match the output
YES
Thanksss.... :))))))
Hey @williamyang1991 , Can you see once my issue, Actually everything is fine but the output image face color is not coming correct as shown in below image output. ππ
I am using all 1 for 18 layers.. also i used 0.6 for 11 layer and 1 for remaining layer...
img_gen, _ = generator([instyle], exstyle, input_is_latent=True, z_plus_latent=False, truncation=0.7, truncation_latent=0, use_res=True, interp_weights=[1]*15+[1]*3) img_gen = torch.clamp(img_gen.detach(), -1, 1)
also i have one question that what is the default value to truncation
Our method is trained on zplus code. So applying wplus code may incur some color artifacts.
there is no default value of truncation, you can just try it and see the difference.
actually only this image input has the issues .. i tried with other with which has lights in the surroundings, output came so nice.
@williamyang1991
WHAT IF YOU TURN OFF --wplus
.
Still has this issue?
when I turn it off --wplus
then output will be different. Like, it will look as a different person.
@williamyang1991
I liked --wplus
encoder.. its output is so good compared to old encoder. but only some bad quality input images causing issues
hey @williamyang1991
This one is --wplus
This one is without --wplus
You only can see the difference in both, How low light on face is appearing using --wplus
and while turning off the --wplus
it's giving totally different face.
Our method is trained on zplus code. So applying wplus code may incur some color artifacts.
The conclusion is obvious. wplus better reconstruction zplus better toonification
So while doing toonification using --zplus
, Some person face is not recognizable, that's the issue, otherwise when u ask me , I will say w+ is far much better.
after changing "W+" encoder also it is coming different style transform, previously I was using "Z+" encoder, both are giving different style transform, it is not close to original image at all, how can i achieve that ?
img_rec, instyle = encoder(F.adaptive_avg_pool2d(I, 256), randomize_noise=False, return_latents=True, resize=False)
if we change "interp_weights=args.weight" getting error ,so intialized to " w "
9687839/222351690-3caa966a-f14b-439b-a77f-92f2f1ee7cc3.jpg)