Giter Site home page Giter Site logo

sunny2109 / safmn Goto Github PK

View Code? Open in Web Editor NEW
219.0 219.0 9.0 328.15 MB

[ICCV 2023] Spatially-Adaptive Feature Modulation for Efficient Image Super-Resolution; runner-up method for the model complexity track in NTIRE2023 Efficient SR challenge

Python 75.28% Cython 9.32% C 13.29% C++ 0.82% Cuda 1.16% Shell 0.03% MATLAB 0.11%
compressed-image-enhancement image-restoration pytorch real-time super-resolution

safmn's Introduction

Hi there 👋

  • 🏫 I am a Ph.D. student at IMAG Lab, Nanjing University of Science & Technology, supervised by Prof. Jinshan Pan.
  • 📔 I’m currently working on low-level vision problems, especially image/video super-resolution, deblurring.

Academic Services

  • Conference Reviewer
    • NeurIPS 2023
    • ICML 2024
    • ICLR 2024
    • CVPR 2022, 2023(Outstanding Reviewer), 2024
    • ECCV 2022, 2024
    • ICCV 2023
    • AAAI 2023, 2024
    • WACV 2024
  • Journal Reviewer
    • IJCV
    • CVIU
    • TCYB
    • TIP

safmn's People

Contributors

sunny2109 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  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  avatar  avatar  avatar  avatar

safmn's Issues

参数、激活数

大佬您好,请问在哪里可以测量参数、激活数等的这些指标?我在您的源码中没有找到关于测试这个指标的代码

LAM visualization code

Hi, authors
Thanks for your great work! The Fig.2 of LAM visualiztion is a very impressive way to demonstrate the different receptive filed between different models. And I also want to implement this, so i wonder is it convenient for you to share the LAM visualiztion code? It will really helps a lot to me :D

Ablation study

Hello, I would like to ask a question:
How is the inverted residual block module defined in ablation experiments? Because I remember that in MobileNet v2, this module has a very small number of parameters.But I saw that in your article's ablation experiment, replacing CCM with inverted residual block significantly increased the parameter quantity.
I would greatly appreciate it if you could help clarify my confusion. Thank you!

"No object named 'RealSRModel' found in 'model' registry!"

I have already loaded the data and pre training model, and I encountered the following error while running the code:
Name RealSRModel_basicsr is not found, use name: RealSRModel_basicsr_basicsr!
Traceback (most recent call last):
File "basicsr/test.py", line 45, in
test_pipeline(root_path)
File "basicsr/test.py", line 35, in test_pipeline
model = build_model(opt)
File "/opt/conda/lib/python3.8/site-packages/basicsr/models/init.py", line 26, in build_model
model = MODEL_REGISTRY.get(opt['model_type'])(opt)
File "/opt/conda/lib/python3.8/site-packages/basicsr/utils/registry.py", line 71, in get
raise KeyError(f"No object named '{name}' found in '{self._name}' registry!")
KeyError: "No object named 'RealSRModel_basicsr' found in 'model' registry!"

AssertionError: An object named 'SAFMN' was already registered in 'arch' registry!的问题

您好,在使用网络时碰见这个问题:第一次完整使用网络训练:python basicsr/train.py -opt options/train/SAFMN/train_DF2K_X2.yml
后未发现异常,可以正常生成结果。但是想重新训练时,出现如下报错:AssertionError: An object named 'SAFMN' was already registered in 'arch' registry!。在train_DF2K_X2.YML中network_g->type修改为SAFMN_NITRE后报错信息仍不变,请问如何解决这个问题,感谢!

颜色空间

大佬您好,跟您请教一下,您的算法是在RGB图像直接处理的还是转化到YCbCr上再进行处理

消融实验

您好,我想请教一些问题:
1、消融实验中SAFM模块是怎么验证的? 去掉的意思是完全不用这个模块还是 换成别的模块替代呢
2、您的特征图可视化是怎么做的呢?
非常希望您能解答我的疑惑,谢谢!

训练过程中val集的问题

孙博士您好,我有个问题需要您指导,您在 options/train/SAFMN /train_DF2K_X2.yml中在验证集中的设置为datasets/DIV2K/DIV2K_Valid/LR_bicubic/X2,我理解的bicubic可以通过matlab或者opencv操作,请问后面的X2要放什么内容,是和训练集一样把图片分辨率降低后的图片放到这个文件夹下吗?

还有一个问题是在进行测试时,train_DF2K_x2.yml文件夹内:
datasets:
test_1: # the 1st test dataset
name: Set5
type: PairedImageDataset
dataroot_gt: datasets/Benchmarks/Set5/HR
dataroot_lq: datasets/Benchmarks/Set5/LR_bicubic/X2
filename_tmpl: '{}x2'
datasets/Benchmarks/Set5/LR_bicubic/X2存放的内容是什么?
谢谢您的指导!

数据集

大佬您好,打扰您一下,您是在DIV2K和Flickr2K数据集上训练的,如果只想在DIV2K上训练的话,请问要往哪方面调参数效果会比较好

推理性能

您好!
我用 Nvidia T4 (性能接近2080Ti) 做了一个推理测试,测试程序是 sample代码app.py, 图片大小2560*1440,scale为2倍模型,处理性能大概是9s多,是不是哪里处理的有问题?或者如何优化?

谢谢!

关于real-world模型

作者您好,请问您real-world模型还是用同样参数量的小模型,follow real-esrgan的方法训练的吗?还是有给模型参数量加大

如何运行3倍

您好,我在Google Colab上成功运行了4被超分和2倍超分模型。然后我用
if test_patch_wise:
!python inference/inference_real_safmn.py --model_path experiments/pretrained_models/SAFMN_DF2K_x3.pth --input BSRGAN/testsets/RealSRSet --output results/SAFMN_x3 --scale 3 --large_input
else:
!python inference/inference_real_safmn.py --model_path experiments/pretrained_models/SAFMN_DF2K_x3.pth --input BSRGAN/testsets/RealSRSet --output results/SAFMN_x3 --scale 3
试图运行3倍超分,结果得到了“预训练模型参数不匹配”的问题。请问应该如何解决,谢谢

比赛的预训练模型

您好,打扰您一下,找不到您比赛时完整的预训练模型(x2 , x3 , x4),在您的文件里只找到了一个关于您的team15_SAFMN.pth文件

color changed

hi, I test SAFMN_L_Real_LSDIR_x4.pth on my own picture, but some pic color is changed, how can I solve this problem?

企业微信截图_16925984406557

batch_size_per_gpu

您好!我在训练时设置batch_size_per_gpu=8训练时间为16h,batch_size_per_gpu=48训练时间为16d,两者CPU均为满负载,是因为CPU IO瓶颈了嘛?将数据集读取格式为lmdb也没有影响。请问是哪里出了问题?

测试与验证不一致

您好,我使用set5与set14作为验证集,但是在同一model上验证与测试的psnr与ssim不一致,请问这是为什么?

Error when converting SAFMN to onnx

Hi, thank you for your hard work!

I am trying to convert SAFMN to onnx but there is a problem with adaptive_max_pool2d

class SAFM(Module):

    def __init__(self, dim, n_levels=4):
        super().__init__()
        self.n_levels = n_levels
        chunk_dim = dim // n_levels

        # Spatial Weighting
        self.mfr = ModuleList([Conv2d(chunk_dim, chunk_dim, 3, 1, 1, groups=chunk_dim) for i in range(self.n_levels)])
        
        # # Feature Aggregation
        self.aggr = Conv2d(dim, dim, 1, 1, 0)
        
        # Activation
        self.act = GELU() 

    def forward(self, x):
        h, w = x.size()[-2:]

        xc = x.chunk(self.n_levels, dim=1)
        out = []
        for i in range(self.n_levels):
            if i > 0:
                p_size = (h//2**i, w//2**i)
                s = torch_nn_adaptive_max_pool2d(xc[i], p_size)
                s = self.mfr[i](s)
                s = torch_nn_interpolate(s, size=(h, w), mode='nearest')
            else:
                s = self.mfr[i](xc[i])
            out.append(s)

        out = self.aggr(torch_cat(out, dim=1))
        out = self.act(out) * x
        return out

I even tried replacing adaptive_max_pool2d with max_pool2d but it still gives an error, is there a way to solve this? :)

importing correct basicsr

Hi, thanks for publishing the code of your work! I am running the test code using commands in your README.md and facing some issues. I used the scripts inside the "scripts" folder to download pre-trained weights and the Set5 dataset.
My current confusion is: Which basicsr module to use? README asks to install it from pip but there is also one packaged inside the repo. Of course, python uses the one from pip by default but is the packaged one different (possibly causing unexpected bugs)?

关于训练时长

大佬你好, 我在a100上跑你们的网络模型要花3天多的时间,这个正常吗?

关于测试数据集

对于数据集B100 Urban100 Manga109,只能下载到HR,我怎么才能获得LR_bicubic呢

测试报错

FileNotFoundError: [Errno 2] No such file or directory: 'experiments/pretrained_model/SAFMN_DF2K_x4.pth'
因为服务器连不了外网,麻烦告诉我去哪里下载预训练模型,

关于损失函数的消融

作者您好!
看到您在文中用了FFT loss,我训练了两三万iter简单试了一下,发现删掉FFT loss指标好像会有所提高,想问问您有没有验证过fft loss对完整训练流程的影响,删去fft loss会导致模型最终性能的下降吗?

高质量yml 询问

作者你好,想请问下,你前面issue里说了real的yml效果好一些,但现在的branch里没有这个配置,只有test有,train没有;
另外,你这些train_DF2K_X4.yml, 还有下划线_L 标识的,和classic,和real是什么意思,模型都是用的SAFMN吗,只有dim深度不同是吗?
我想用最好的是选哪个,怎么会配置?
想用论文或者比赛里的,怎么配置?
想用超轻量的,怎么配置?

How to prepare data?

Hi, how do I prepare datasets for training. Say that I want to train the efficient model using DIV2k dataset? What dataset did you use to train the SAFMN_L_Realx4.pth -model?

训练时损失变为nan

请问作者在训练的时候有没有出现损失变为nan的情况呢?如果有的话是怎样解决的呢?

which is the best model?

Hello, I am really interested in your research. I find that there are three different models in your NTIRE2023_ESR. Could you tell me which one is the best model? Thank you very much!

推理时间

大佬,想问下:在set5数据集上,X4SR,平均推理时间达到了0.5s左右,这不正常吧。会是什么原因导致?

使用NTIRE-2023数据集如何设置YML文件?

您好,
感谢您的精彩论文,既有很好的创新,也很实用。我想用这个网络尝试跑这个数据集(NTIRE 2023 Efficient SR challenge),请问如何设置训练和测试的YML文件呢?

SAFMN_Real 如何训练

您好!对您提供的SAFMN_Realx2.pth在真实图像中的超分表现我们感觉效果很好,但是这个在Set5数据集上的评估PSNR就比较低,
2024-04-20 17:37:07,104 INFO: Loading SAFMN model from D:/pythonSoftware/codes/SAFMN/models_pretrain/SAFMN_L_Real_LSDIR_x2.pth, with param key: [params].
2024-04-20 17:37:07,190 INFO: Model [SRModel] is created.
2024-04-20 17:37:07,191 INFO: Testing Set5...
2024-04-20 17:37:08,370 INFO: Validation Set5
# psnr: 25.5341 Best: 25.5341 @ SAFMN_c36n8_x2 iter
# ssim: 0.8602 Best: 0.8602 @ SAFMN_c36n8_x2 iter
所以i想请教您SAFMN_Real是如何训练的呢? 谢谢!!!

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.