Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I visualize the img2 in max_ssim.py, but it is not the gif shown in the home page. what mistake do I make? The following is the code, modified in max_ssim.py. #22

Open
THHHomas opened this issue Aug 12, 2019 · 1 comment

Comments

@THHHomas
Copy link

while ssim_value < 0.95:
optimizer.zero_grad()
ssim_out = -ssim_loss(img1, img2)
ssim_value = - ssim_out.item()
print(ssim_value)
ssim_out.backward()
optimizer.step()
ii = np.transpose(img2[0].detach().cpu().numpy(), (1,2,0))
cv2.imshow("pre", ii255)
print(np.max(ii
255))
cv2.waitKey(100)

@bornabesic
Copy link

You haven't explained what kind of results you get, but I guess you are looking at a noisy white image. After you multiply the array by 255 you also need to convert it to a byte type.

cv2.imshow("pre", (ii * 255).astype(np.uint8))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants