Comments (9)
Thank you very much for your timely reply, which is very helpful to me!
from pisr.
Hello, thanks for your attention.
Actually, the codes for obtaining high-freq signals are not organized well because we implemented it in the jupyter-notebook file.
Instead of sharing the full code, I gonna provide you the core functions.
def get_spectrum(img):
f = np.fft.fft2(img)
fshift = np.fft.fftshift(f)
magnitude_spectrum = 20*np.log(np.abs(fshift))
return magnitude_spectrum.squeeze()
def plot_spectrum(lr_upsampled, hr, encoded_lr_upsampled, notim_encoded_lr_upsampled):
magnitude_spectrum_hr = get_spectrum(hr)
magnitude_spectrum_lr = get_spectrum(lr_upsampled)
magnitude_spectrum_encoded_lr = get_spectrum(encoded_lr_upsampled)
magnitude_spectrum_notim = get_spectrum(notim_encoded_lr_upsampled)
# skip detailed codes. #
plt.plot(magnitude_spectrum_lr[h, w-m:w+m])
plt.plot(magnitude_spectrum_encoded_lr[h, w-m:w+m])
plt.plot(magnitude_spectrum_notim[h, w-m:w+m])
plt.show()
I hope those are helpful.
from pisr.
I have some problems that I hope you can solve.
-
In "magnitude_spectrum_hr[h,w - m:w + m]", h and w should be the height and width of the input image, but I don't understand what "m" means.
-
I see that all the low resolution (lr) images in the code are suffixed with "_upsampled", which means that the results obtained in Fig. 3 in the paper are compared after being upsampled on the low resolution images? If so, which upsampling method is used.
Looking forward to your reply again.
from pisr.
-
First of all, the input of the function is a cropped image whose size is 200 by 200 (for the HR case).
As you know, the output of the functionget_spectrum()
has the same shape of the image, which is 200 by 200 in this case.
For plotting the magnitude spectrum like the left-bottom of Figure 3, we only need the 100th row (i.e., v=0 results from the fft-shift) of the output, therefore we seth
to 100.
Also, we setw
andm
to 100 and 50, respectively, I'll explain the reason in the next answer. -
If we'd like to plot both magnitude spectrums from HR and LR into one figure, we need to calibrate the frequency axis of them because the shapes of each spectrum are (200, 200) and (100, 100), respectively. Therefore, we upsampled LR and encoded LR images by two times with a bilinear interpolation method.
After the upsampling, the magnitude components atu > 150
andu < 50
are not originated from the LR (and encoded LR) images. This led us to setw
andm
to 100 and 50.
from pisr.
Thank you for your kind and attentive reply!
Since I am not solid enough in Fourier transform, I may make mistakes when testing my images. Here are a few questions. If the size of my high-resolution (hr) image is 360x256 and the size of my low-resolution (lr) image is 45x32, and the lr image is upsampled by eight times with a bilinear interpolation. Can the values of h, w and m be set to 180, 180 and 64 respectively?
Looking forward to your reply, thanks again!
from pisr.
This figure shows the results of HR and LR in the previous comment. The red line is HR and the blue line is LR
from pisr.
I think m
should be 16 (= 256 / 8 / 2, which has the same relationship with 200 / 2 / 2 of our case).
from pisr.
OK, I get it.
Thank you.
from pisr.
Hello!
Have you run the author's code?The author's code, it doesn't work
Have you made any changes to the author's code?
from pisr.
Related Issues (20)
- Training help HOT 4
- Can we scale up 8 times?? HOT 2
- How can I visualize the result with the visualizer in your code? HOT 1
- About Teacher Network HOT 1
- How to get the subjective visual results after the testing dataset is inferred? HOT 1
- Why my training data is expanded in Teacher net? HOT 1
- what's your principle for choosing which layer as the vid layer for different SR algorithms?
- Encounter an unexpected error during training
- step1_train_teacher.py", line 123 HOT 1
- In step2_train_student.py
- 对模型的疑问? HOT 2
- Hello,can you tell me how to test the model HOT 6
- pretrained_model does not exist
- train student network HOT 3
- where is the Student network initialized with teacher network parameter? HOT 2
- losses HOT 4
- an issue about the results of paper model. HOT 3
- encoder HOT 2
- Could this method be applied to EDVR model? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pisr.