small-dataset-image-generation
small-dataset-image-generation copied to clipboard
How to load .h5 checkpoint?
Hello, I want to run inference so I need to load my '.h5' checkpoint. I don't have much experience with chainer framework. Could you please let me know how I can do that and run inference?
You could do the following for inference
-
Initialize the generator and load pretrained weights. e.g. biggan based model gen = AdaBIGGAN(config, datasize, comm=comm) chainer.serializers.load_npz("your_pretrained_model.h5", gen.gen) gen.to_gpu(device) # send to gpu if necessary gen.gen.to_gpu(device) # send to gpu if necessary
-
Random sampling e.g. randomly sample 5 images with temperature=0.5 without truncation random_imgs = gen.random(tmp=0.5, n=5, truncate=False)
-
Interpolation e.g. interpolation between 0th and 1st image interpolated_imgs = gen.interpolate(self, source=0, dest=1, num=5)
I don't actually run it now, so it may not work. Please let me know if it doesn't work.