Git Product home page Git Product logo

pams's People

Contributors

colorjam avatar leehxalice avatar proqha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pams's Issues

Training Error

image

Thank you for sharing your excellent work. I got a problem when network training.

train problem

HI,author,thanks for your excellent work. I set different k_bits(8 and 4),but trained models have same size,I want to know ,when set k_bits=8,gain the trained model(model_best.pth.tar) is quantized model?

Unable to load 4bit_rdn_x4.pt

Hello,

I am trying to test pretrained rdn model. I was able to run edsr model but unable to load 4bit_rdn_x4.pt model and facing the below issue while loading.

Please help.
image

seems nothing output after running test

Hi,

I try to reproduce your result by following commands:

python main.py --scale 4 --k_bits 8 --refine ./pretrained/8bit_edsr_x4.pt --save_results --data_test Set5+Set14+B100+Urban100 --save edsr_x4/8bit/ --dir_data ../DIV2K --test_only --model EDSR
Load model from ./pretrained/8bit_edsr_x4.pt
edsr_x4/8bit/ start!

Evaluation:
0it [00:00, ?it/s]
[Set5 x4] PSNR: nan (Best: nan @epoch 1)
WARNING:root:NaN or Inf found in input tensor.
0it [00:00, ?it/s]
[Set14 x4] PSNR: nan (Best: nan @epoch 1)
WARNING:root:NaN or Inf found in input tensor.
0it [00:00, ?it/s]
[B100 x4] PSNR: nan (Best: nan @epoch 1)
WARNING:root:NaN or Inf found in input tensor.
0it [00:00, ?it/s]
[Urban100 x4] PSNR: nan (Best: nan @epoch 1)
WARNING:root:NaN or Inf found in input tensor.
Total: 1.12s

But there is nothing in edsr_x4/8bit/, am I missing anything else?

Thx,
Lei

Something confusion about the testing

Thank you for sharing your excellent work.
I'm confused about after the quantization aware training process, we obtain the trained weights and alphas, and then how can i convert the quantization aware trained floating point model to quantized integer model to perform the 8bit calculation and obtain the finnal results in the paper.

复现精度

您好,我按照run.sh中命令进行训练,8bit,patch_size取192,scale取4时,训练30个epoch,在Set14上的PSNR为28.174dB,和您论文里的28.585dB相差很大,请问这是什么原因呢?

Some confusion in quant_ops.py

Thank you for sharing your excellent work.
I am confusied about the line 78 in quant_ops.py, why the ‘self.epoch’ was always set to 1, shouldn't it change over the course of training?
Another confusion is the line 94 and line 97 in quant_ops.py, ‘’self.training‘’ seemed not be defined?

something wrong ahout 4bit_rdn_x4.pt

ckpt = torch.load(f'{args.refine}') cannot load 4bit_rdn_x4.pt
maybe somethine wrong about it

(pytorch110) robert@robert-Z390-GAMING-X:~/DeepLearning/ModelCompression/PAMS-master$ cd /home/robert/DeepLearning/ModelCompression/PAMS-master ; /usr/bin/env /home/robert/anaconda3/envs/pytorch110/bin/python /home/robert/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/launcher 35723 -- /home/robert/DeepLearning/ModelCompression/PAMS-master/main.py --scale 4 --k_bits 4 --model RDN --data_test Set14 --save output/rdn_x4/8bit --dir_data /home/robert/Datasets/SuperResolutionData --test_only --refine ./pretrained/4bit_rdn_x4.pt --save_results
Traceback (most recent call last):
File "/home/robert/DeepLearning/ModelCompression/PAMS-master/main.py", line 255, in
main()
File "/home/robert/DeepLearning/ModelCompression/PAMS-master/main.py", line 236, in main
ckpt = torch.load("./pretrained/4bit_rdn_x4.pt")
File "/home/robert/anaconda3/envs/pytorch110/lib/python3.7/site-packages/torch/serialization.py", line 387, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File "/home/robert/anaconda3/envs/pytorch110/lib/python3.7/site-packages/torch/serialization.py", line 581, in _load
deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: storage has wrong size: expected 0 got 1

How to calculate the ssim claimed in the paper?

Thanks for your share.
I have some problem about how to calculate the model's ssim.
When I test the model '4bit_edsrx4.pt' released on google drive, the psnr I got match to the paper's result, but the ssim=0.950 on Set5x4( ssim=0.8851 in the paper).

ps. I used the function calc_ssim provided in utility.py to calculate ssim, but the result doesn't match the paper's.

How to calculate model size claimed in paper

Hi @colorjam ,

As per the paper, claimed model size is 1.518MB for EDSR, 0.631MB for 8bit EDSR, 0.484MB for 4-bit EDSR model but in you google drive shared models all 3 models are of 6MB size. Can you let me know how you get the above claimed model size.
image

Training result not reproducible

Thanks for sharing the code.
But unfortunately, the training result from setting in run.sh doesn't meet the results of the paper.
Training for 8bit EDSR x4 only reaches 31.45 for set 5, which is far behind the reported results.

Are there any specific settings to reproduce the pretrained 4bit_EDSR_x4 or 8bit_EDSR_x4?

Something wrong about the pretrained models

Hi,

I tried to test the pre-trained model downloaded from google drive and something wrong happened.

I ran the following code in the terminal:

python main.py --scale 4 --model EDSR --k_bits 8 --save_results --test_only --data_test Set5+Set14+B100+Urban100 --refine ./pretrained/8bit_edsr_x4.pt.tar --save "output/edsr_x4/8bit" --dir_data G:\\Computer\\Datasets
which was copied from run.sh

and a RuntimeError happened as follow

Traceback (most recent call last): File "main.py", line 274, in <module> main() File "main.py", line 259, in main s_model.load_state_dict(s_checkpoint) File "E:\Anaconda3\Anaconda\envs\Exp_tor_1_1_0\lib\site-packages\torch\nn\modules\module.py", line 777, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for PAMS_EDSR: Missing key(s) in state_dict: "body.0.quant_act1.alpha", "body.0.quant_act1.max_val", "body.0.quant_act2.alpha", "body.0.quant_act2.max_val", "body.0.quant_act3.alpha", "body.0.quant_act3.max_val", "body.0.body.2.max_val", "body.1.quant_act1 .alpha", "body.1.quant_act1.max_val", "body.1.quant_act2.alpha", "body.1.quant_act2.max_val", "body.1.quant_act3.alpha", "body.1.quant_act3.max_val", "body.1.body.2.max_val", "body.2.quant_act1.alpha", "body.2.quant_act1.max_val", "body.2.quant_act2 .alpha", "body.2.quant_act2.max_val", "body.2.quant_act3.alpha", "body.2.quant_act3.max_val", "body.2.body.2.max_val", "body.3.quant_act1.alpha", "body.3.quant_act1.max_val", "body.3.quant_act2.alpha", "body.3.quant_act2.max_val", "body.3.quant_act3 .alpha", "body.3.quant_act3.max_val", "body.3.body.2.max_val", "body.4.quant_act1.alpha", "body.4.quant_act1.max_val", "body.4.quant_act2.alpha", "body.4.quant_act2.max_val", "body.4.quant_act3.alpha", "body.4.quant_act3.max_val", "body.4.body.2.max _val", "body.5.quant_act1.alpha", "body.5.quant_act1.max_val", "body.5.quant_act2.alpha", "body.5.quant_act2.max_val", "body.5.quant_act3.alpha", "body.5.quant_act3.max_val", "body.5.body.2.max_val", "body.6.quant_act1.alpha", "body.6.quant_act1.max _val", "body.6.quant_act2.alpha", "body.6.quant_act2.max_val", "body.6.quant_act3.alpha", "body.6.quant_act3.max_val", "body.6.body.2.max_val", "body.7.quant_act1.alpha", "body.7.quant_act1.max_val", "body.7.quant_act2.alpha", "body.7.quant_act2.max _val", "body.7.quant_act3.alpha", "body.7.quant_act3.max_val", "body.7.body.2.max_val", "body.8.quant_act1.alpha", "body.8.quant_act1.max_val", "body.8.quant_act2.alpha", "body.8.quant_act2.max_val", "body.8.quant_act3.alpha", "body.8.quant_act3.max _val", "body.8.body.2.max_val", "body.9.quant_act1.alpha", "body.9.quant_act1.max_val", "body.9.quant_act2.alpha", "body.9.quant_act2.max_val", "body.9.quant_act3.alpha", "body.9.quant_act3.max_val", "body.9.body.2.max_val", "body.10.quant_act1.alph a", "body.10.quant_act1.max_val", "body.10.quant_act2.alpha", "body.10.quant_act2.max_val", "body.10.quant_act3.alpha", "body.10.quant_act3.max_val", "body.10.body.2.max_val", "body.11.quant_act1.alpha", "body.11.quant_act1.max_val", "body.11.quant_ act2.alpha", "body.11.quant_act2.max_val", "body.11.quant_act3.alpha", "body.11.quant_act3.max_val", "body.11.body.2.max_val", "body.12.quant_act1.alpha", "body.12.quant_act1.max_val", "body.12.quant_act2.alpha", "body.12.quant_act2.max_val", "body. 12.quant_act3.alpha", "body.12.quant_act3.max_val", "body.12.body.2.max_val", "body.13.quant_act1.alpha", "body.13.quant_act1.max_val", "body.13.quant_act2.alpha", "body.13.quant_act2.max_val", "body.13.quant_act3.alpha", "body.13.quant_act3.max_val ", "body.13.body.2.max_val", "body.14.quant_act1.alpha", "body.14.quant_act1.max_val", "body.14.quant_act2.alpha", "body.14.quant_act2.max_val", "body.14.quant_act3.alpha", "body.14.quant_act3.max_val", "body.14.body.2.max_val", "body.15.quant_act1. alpha", "body.15.quant_act1.max_val", "body.15.quant_act2.alpha", "body.15.quant_act2.max_val", "body.15.quant_act3.alpha", "body.15.quant_act3.max_val", "body.15.body.2.max_val". Unexpected key(s) in state_dict: "body.0.activation1.alpha", "body.0.activation2.alpha", "body.0.activation3.alpha", "body.1.activation1.alpha", "body.1.activation2.alpha", "body.1.activation3.alpha", "body.2.activation1.alpha", "body.2.acti vation2.alpha", "body.2.activation3.alpha", "body.3.activation1.alpha", "body.3.activation2.alpha", "body.3.activation3.alpha", "body.4.activation1.alpha", "body.4.activation2.alpha", "body.4.activation3.alpha", "body.5.activation1.alpha", "body.5.a ctivation2.alpha", "body.5.activation3.alpha", "body.6.activation1.alpha", "body.6.activation2.alpha", "body.6.activation3.alpha", "body.7.activation1.alpha", "body.7.activation2.alpha", "body.7.activation3.alpha", "body.8.activation1.alpha", "body. 8.activation2.alpha", "body.8.activation3.alpha", "body.9.activation1.alpha", "body.9.activation2.alpha", "body.9.activation3.alpha", "body.10.activation1.alpha", "body.10.activation2.alpha", "body.10.activation3.alpha", "body.11.activation1.alpha", "body.11.activation2.alpha", "body.11.activation3.alpha", "body.12.activation1.alpha", "body.12.activation2.alpha", "body.12.activation3.alpha", "body.13.activation1.alpha", "body.13.activation2.alpha", "body.13.activation3.alpha", "body.14.activat ion1.alpha", "body.14.activation2.alpha", "body.14.activation3.alpha", "body.15.activation1.alpha", "body.15.activation2.alpha", "body.15.activation3.alpha". size mismatch for body.0.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.1.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.2.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.3.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.4.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.5.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.6.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.7.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.8.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.9.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.10.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.11.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.12.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.13.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.14.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]). size mismatch for body.15.body.2.alpha: copying a param with shape torch.Size([]) from checkpoint, the shape in current model is torch.Size([1]).
It seems that the pre-trained model's parameters are different from the parameters defined in edsr.py .
Did I ignore some important details? Or did you provide a model that doesn't match the current code?

Hoping you can reply as soon as possible, Thanks~

Testing error

I build a new model, after quantization aware training this model, we meet the following test error.
捕获
can u give me some suggestions?

code doesn't match the paper

The figure 1 in the paper implies that the input of 1st conv in the PAMSblock is quantized.
However, according to your code, the input of 1st convolution in the residual block is not quantized.
Accordingly, the experimental results are from the wrong code..?
Can you solve the inconsistency?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.