I'm trying to load a pre trained torch (.t7) model in OpenCV. The model is a CycleGAN which converts horse images into zebra images. The model can be found here: https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/models/
I've used both horse2zebra.t7 and horse2zebra_cpu.t7 models but they both return a tiled black and white image instead of a zebra image.
This is a sample input image:
And this is the output:
Code:
import cv2
import numpy as np
model = cv2.dnn.readNetFromTorch('./cyclegan_horse2zebra_cpu.t7')
image = cv2.imread('./images/1.jpg')
blob = cv2.dnn.blobFromImage(image, 1, (256, 256))
model.setInput(blob)
out = model.forward()[0,:,:,:]
out = np.reshape(out, (256, 256, 3))
cv2.imshow('image', out)
cv2.waitKey(0)
cv2.imwrite('out.png', out)


