-
-
Notifications
You must be signed in to change notification settings - Fork 88
Description
I've run through the codes and was able to generate images by running the model. I realize that the images generated were sort of over exposed. I modified the codes to use pytorch's own save_image function, instead of opencv as was used in the codes, and found that I could achieve better results.
using a mean and std of:
mean = np.asarray([ 0.485, 0.456, 0.406 ])
std = np.asarray([ 0.229, 0.224, 0.225 ])
I used this transforms for loading:
transforms.ToTensor(),
transforms.Normalize(mean, std, inplace=True), # normalize image based on mean and std of ImageNet dataset
transforms.Lambda(lambda x: x.mul(255.))
and these transforms for saving:
transforms.Lambda(lambda x: x.div(255.) ),
transforms.Normalize((-1 * mean / std), (1.0 / std),inplace=True)
saving to file uses torch.utils.save_image function which accepts tensor.
couple of thing that puzzles me:
- running the training is very fast. 3000 epochs completed within 6+ mins. I could not figure out how you made it so fast. could you please advice me?
-
- loss backward doesn't require retain_graph=True. I independently wrote one myself and it gave error during training, about the graph being freed and calling basckward a second time. I only managed to train it by setting retain_graph to True. Could you please enlighten me why you could reuse the content and style outputs for the respective images, and only generates the outputs for the optimizing_umg and yet don't need to set retain_graph to True?