Open ucalyptus2 opened 1 year ago
Is there any answer to this thread? I am also stuck to find the inference for a single image.
I spent long time understanding the code, finally I realized that I should provide the framework with both HR and LR to evaluate it. There is no option to test it without a ground-truth dataset.
We will update the code for the inference on a single image as soon as possilble.
I also have same question
any update?
I write a simple code to test on a single image, just like below: Replace the code in https://github.com/Francis0625/Omni-SR/blob/6f5e53b2e0f0afb20901b4270c0a7a08e0a54d1d/test_scripts/tester_Matlab.py#L135 by:
test_single = True
with torch.no_grad():
if test_single:
from PIL import Image
from torchvision import transforms as T
save_dir = "test/result/dir"
transform_valid = T.Compose([
T.ToTensor(),
T.Normalize(mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5)) ])
img_path = "image/to/test.png"
img = Image.open(img_path)
img_ = transform_valid(img)
image = img_.unsqueeze(0)
image = image.cuda()
res = self.network(image)
res = tensor2img(res.cpu())
temp_img = res[0, :, :, :]
temp_img = cv2.cvtColor(temp_img, cv2.COLOR_RGB2BGR)
name = os.path.basename(img_path)
cv2.imwrite(os.path.join(save_dir, 'test_in_author_{}'.format(name)), temp_img)
final_psnr = 0.0
final_ssim = 0.0
else:
Also trying to figure it out...