Comments (3)
appologies please replace info['fixed_fake_images'] with the following line
info['fixed_fake_images'] = self.to_np(denorm(fake_images.data).view(*display_vars)[:5, :, :, :])
from self-attention-gan.
could share the code entirely?
from self-attention-gan.
You can add a tensorboard logging to the train.py by inserting the following code at line 180. This needs to be modified because l4 does not exist if imsize is less than 64 and the network fails if imsize is greater than 64. When the larger imsize is fixed I will issue a pull request. Also build_tensorboard should be changed. Hope this helps!
def build_tensorboard(self): from logger import Logger if os.path.exists(self.log_path): shutil.rmtree(self.log_path) os.makedirs(self.log_path) self.logger = Logger(self.log_path)
Insert at line 180 in train.py
Print out log info
if (step + 1) % self.log_step == 0:
elapsed = time.time() - start_time
elapsed = str(datetime.timedelta(seconds=elapsed))
print("Elapsed [{}], G_step [{}/{}], D_step[{}/{}], d_out_real: {:.4f}, "
" ave_gamma_l3: {:.4f}, ave_gamma_l4: {:.4f}".
format(elapsed, step + 1, self.total_step, (step + 1),
self.total_step, d_loss_real.item(),
self.G.attn1.gamma.mean().item(), self.G.attn2.gamma.mean().item()))# (1) Log values of the losses (scalars) info = { 'd_loss_real': d_loss_real.item(), 'd_loss_fake': d_loss_fake.item(), 'd_loss': d_loss.item(), 'g_loss_fake': g_loss_fake.item(), 'ave_gamma_l3': self.G.attn1.gamma.mean().item(), 'ave_gamma_l4': self.G.attn2.gamma.mean().item(), } for tag, value in info.items(): self.logger.scalar_summary(tag, value, step + 1) # Sample images / Save and log if (step + 1) % self.sample_step == 0: # (2) Log values and gradients of the parameters (histogram) for net, name in zip([self.G, self.D], ['G_', 'D_']): for tag, value in net.named_parameters(): tag = name + tag.replace('.', '/') self.logger.histo_summary(tag, self.to_np(value), step + 1) # (3) Log the images info = { 'fake_images': self.to_np(fake_images.view(*display_vars)[:10, :, :, :]), 'real_images': self.to_np(real_images.view(*display_vars)[:10, :, :, :]), } fake_images, _, _ = self.G(fixed_z) save_image(denorm(fake_images.data), os.path.join(self.sample_path, '{}_fake.png'.format(step + 1))) info['fixed_fake_images'] = self.to_np(denorm(real_images.data).view(*display_vars)[:10, :, :, :]) for tag, image in info.items(): self.logger.image_summary(tag, image, step + 1)
share the code entirely? thx
from self-attention-gan.
Related Issues (20)
- About negative gamma HOT 10
- detach fake image when updating the discriminator
- model.py is working only for imsize=64 HOT 1
- Missing one 1x1 conv on output from attention layer? HOT 4
- UnboundLocalError: local variable 'dataset' referenced before assignment HOT 4
- dropbox link missing HOT 1
- The code is different from the original paper HOT 2
- RuntimeError: cublas runtime error : the GPU program failed to execute at /pytorch/aten/src/THC/THCBlas.cu:450
- 1
- the meaning of Gamma in Attention model HOT 2
- How to make the repo available for input image of 256x256 size? HOT 1
- torch.bmm(), CUDA out of memory. HOT 3
- Negative self.gamma parameter??
- Confused by self-attention layer positioning in Discriminator HOT 1
- self.gamma*out considered as "in place" operation
- Trying the Self-Attention-GAN with dog images
- Add examples to work with audio files as well
- 我长期研究和改进GAN,如果对GAN或者深度学习感兴趣的可以联系我,联系方式,wechat: lovedaixiaobaby
- How can I determine if the model has converged?
- the download.sh can't use
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from self-attention-gan.