elvisyjlin / spatialattentiongan Goto Github PK
View Code? Open in Web Editor NEWSaGAN PyTorch "Generative Adversarial Network with Spatial Attention for Face Attribute Editing"
License: MIT License
SaGAN PyTorch "Generative Adversarial Network with Spatial Attention for Face Attribute Editing"
License: MIT License
Can you give me an example of colab notebook to train the model? since i've tried execute a script in Google Colab, however, what i've got is that
!python3 /content/SpatialAttentionGAN/train.py --experiment-name celeba_128_eyeglasses --target-attr Eyeglasses --gpu
Namespace(data_path='./data/celeba', attr_path='./data/list_attr_celeba.txt', target_attr='Goatee', image_size=128, batch_size=16, lr=0.0002, beta1=0.5, beta2=0.999, l1=20, l2=100, lgp=10, d_iters=3, total_kimg=1000, tick_kimg=5.0, sample_ticks=1, save_ticks=10, num_samples=64, experiment_name='celeba_128_eyeglasses2', gpu=False)
Traceback (most recent call last):
File "/content/SpatialAttentionGAN/train.py", line 119, in <module>
vutils.save_image(fixed_reals, join(sample_path, '{:07d}_real.jpg'.format(0)), nrow=8, padding=0, normalize=True, range=(-1., 1.))
File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torchvision/utils.py", line 146, in save_image
grid = make_grid(tensor, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
TypeError: make_grid() got an unexpected keyword argument 'range'
Hi!
When I run train.py, it occured:
Traceback (most recent call last):
File "train.py", line 148, in
fakes, _ = G(reals, target_labels)
File "/home/rain/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/rain/nlp/etrump/txt2img/SAGAN_celeba/sagan.py", line 95, in forward
y = self.AMN(x, a)
File "/home/rain/software/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/rain/nlp/etrump/txt2img/SAGAN_celeba/sagan.py", line 83, in forward
x = torch.cat((x, a), dim=1)
RuntimeError: Expected object of backend CUDA but got backend CPU for sequence element 1 in sequence argument at position #1 'tensors'
Can you help me with it?
Thank you so much!
My use case is I'm gonna pass a face image to the GAN model and it should return the same image with eyeglasses.
can i use your code to do it ? If yes , i need some suggestion.
Thanks .
hi,your work is great, but i want to know how to get the 128*128 Align&Cropped Images?
Thanks for your excellent work, but I got similar problem as #1.
Traceback (most recent call last):
File "generate.py", line 80, in <module>
samples, masks = G(reals, target_labels)
File "/home/zhiyong/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/home/zhiyong/temp_test/SpatialAttentionGAN/sagan.py", line 98, in forward
y = self.AMN(x, a)
File "/home/zhiyong/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/home/zhiyong/temp_test/SpatialAttentionGAN/sagan.py", line 86, in forward
x = torch.cat((x, a), dim=1)
RuntimeError: Expected object of backend CUDA but got backend CPU for sequence element 1 in sequence argument at position #1 'tensors'
And I fixed it by modify the code in line76, generate.py.
reals, labels = reals.to(device), labels.type_as(reals).to(device)
Maybe you can update the generate.py to fix it.
hi, i have other question, that is why the result of color of glass is light
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.