Skip to content

Commit

Permalink
still a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrunia committed Dec 12, 2018
1 parent 2346521 commit 1e32704
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
19 changes: 19 additions & 0 deletions steerable/SCFpyr_NumPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,27 @@ def reconstruct(self, coeff):
hidft = np.fft.fftshift(np.fft.fft2(coeff[0]))
outdft = tempdft * lo0mask + hidft * hi0mask

real = outdft.real
imag = outdft.imag
print(' [numpy] levels remaining {}. outdft real ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), real.mean().item(), real.std().item(), real.sum().item()
))
print(' [numpy] levels remaining {}. outdft imag ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), imag.mean().item(), imag.std().item(), imag.sum().item()
))

reconstruction = np.fft.ifftshift(outdft)
reconstruction = np.fft.ifft2(reconstruction)

real = reconstruction.real
imag = reconstruction.imag
print(' [numpy] levels remaining {}. outdft real ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), real.mean().item(), real.std().item(), real.sum().item()
))
print(' [numpy] levels remaining {}. outdft imag ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), imag.mean().item(), imag.std().item(), imag.sum().item()
))

reconstruction = reconstruction.real.astype(np.uint8)

return reconstruction
Expand Down
21 changes: 21 additions & 0 deletions steerable/SCFpyr_PyTorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,29 @@ def reconstruct(self, coeff):

hidft = np.fft.fftshift(np.fft.fft2(coeff_0))
outdft = tempdft * lo0mask + hidft * hi0mask


real = outdft.real
imag = outdft.imag
print(' [torch] levels remaining {}. outdft real ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), real.mean().item(), real.std().item(), real.sum().item()
))
print(' [torch] levels remaining {}. outdft imag ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), imag.mean().item(), imag.std().item(), imag.sum().item()
))

reconstruction = np.fft.ifftshift(outdft)
reconstruction = np.fft.ifft2(reconstruction)

real = reconstruction.real
imag = reconstruction.imag
print(' [torch] levels remaining {}. outdft real ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), real.mean().item(), real.std().item(), real.sum().item()
))
print(' [torch] levels remaining {}. outdft imag ({:.3f}, {:.3f}, {:.3f})'.format(
len(coeff), imag.mean().item(), imag.std().item(), imag.sum().item()
))

reconstruction = reconstruction.real.astype(np.uint8)

return reconstruction
Expand Down

0 comments on commit 1e32704

Please sign in to comment.