idealo / image-super-resolution

🔎 Super-scale your images and run experiments with Residual Dense and Adversarial Networks.

Home Page:https://idealo.github.io/image-super-resolution/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to combine model predictions?

maxcw opened this issue · comments

When I perform training, models for the generator, discriminator and feature extractor are saved. When I want to perform prediction, is there a way to combine these models? How would I incorporate the loss_weights into that? Or is that not really the point, and I should just train with each model separately in different stages, and predict with a single model?

Hi, have you figured it out? I also have this question.

You train two different RRDN models, one with the discriminator off and one with both. Save both the weights to file. Then do this:

from ISR.models import RRDN

network1 = RRDN(arch_params= your training params)
network2 = RRDN(same as above)
interpolated_network = RRDN(same as above)

network1.model.load_weights()
network2.model.load_weights()

vars1 = [v.numpy() for v in network1.trainable_variables]
vars2 = [v.numpy() for v in network2.trainable_variables]

for i, var in enumerate(interpolated_network.model.trainable_variables):
var.assign( (1-a)vars1[i] + avars2[i] )

Thanks!