Giter Club home page Giter Club logo

dncnn-pytorch's Introduction

Aha! You found me! 👋


Credits

anuraghazra/github-readme-stats

Ileriayo/markdown-badges

Envoy-VC/awesome-badges

dncnn-pytorch's People

Contributors

saoyan 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

dncnn-pytorch's Issues

AttributeError: 'Variable' object has no attribute 'item'

Hi, thank you for your share. When I train DnCNN-S, I get this error after I get the train.h5 and the val.h5.
Could you please help me solve it?
......
file: data/Set12/09.png
file: data/Set12/10.png
file: data/Set12/11.png
file: data/Set12/12.png
training set, # samples 238400

val set, # samples 12

Loading dataset ...

of training samples: 238400

learning rate 0.001000
Traceback (most recent call last):
File "train.py", line 126, in
main()
File "train.py", line 88, in main
(epoch+1, i+1, len(loader_train), loss.item(), psnr_train))
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py", line 67, in getattr
return object.getattribute(self, name)
AttributeError: 'Variable' object has no attribute 'item'

About the residual strategy

Dear author,
I `ve found a difference between your train code and CSZN DNCNN pytorch train code.

  1. In his train code, the loss is calculated like this:

loss = criterion(model(batch_y), batch_x)_
Since the output of his model was clean image. He define the loss by output and clean-groundtruth.

  1. But in ur train code, the loss is calculated like this:
    loss = criterion(out_train, noise) / (imgn_train.size()[0]*2)
    Since the output of ur model was the residual noise map. You define the loss by output and the noise-groundtruth

So the question is:

  • Would this difference influence the training result?
  • For denoising, is it maybe a better way to take clean image as ground-truth instead of noise residual?

Implementation may be wrong

Hello and thanks for your reproduction!
When I went through model.py, I noticed that in the forward method, you returned out instead of x - out, which is corresponding to residual learning in the author's article, I wonder if it's a mistake or I missed something. Thanks!

FFDNet in PyTorch

Hi SaoYan,

I was wondering if by any chance you are working or already have PyTorch version of FFDNet. It is an advanced version of DnCNN -- but only MatConvNet version is available from author's GitHub.

https://github.com/cszn/FFDNet

Thanks,
Touqeer

关于残差与loss function问题

您好!
在您写的代码中,有一段没有看懂,望指点:
在train.py中,
out_train = model(imgn_train)
loss = criterion(out_train, noise) / (imgn_train.size()[0]*2)
...

results

model.eval()
out_train = torch.clamp(imgn_train-model(imgn_train), 0., 1.)
psnr_train = batch_PSNR(out_train, img_train, 1.)

1.为什么已经定义了out_train,后面还要重新定义out_train呢
2.为什么要除imgn_train.size()[0]*2。0.,1. 是什么意思啊
3.残差是指的代码中的哪个呢,文章中是 l = 1/2N ||R(y) - (y -x) ||2,文章中的残差是R(y)吧

新手,谢谢指点

make my own dataset

i have some images with fuzzy&small target,i wanna to get a higher signal-to-miscellaneous ratio and higher quality image,how can i make noise images and .h5 train &test file??

Testing DnCNN on CPU

Hi SaoYan,

Thank you for sharing your codes at GitHub!
I was trying to test the model on my Mac machine -- but I am having issue with it, can you please advise as how to proceed with that. The models have been trained using GPU and I am trying on CPU -- so it is causing problem when I try to load the model. I am a newbie to PyTorch, any help in this regards will be great.

Thanks,
Touqeer

h5py wrong

File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 106, in h5py.h5f.open
OSError: Unable to open file (file signature not found)
下面这段代码出错(wrong)
class Dataset(udata.Dataset):
def init(self, train=True):
super(Dataset, self).init()
self.train = train
if self.train:
h5f = h5py.File('train.h5', 'r')
# h5f = h5py.File('C:/pytorch/DnCNN-PyTorch-master/train.py', 'r')
else:
h5f = h5py.File('val.h5', 'r')
self.keys = list(h5f.keys())
random.shuffle(self.keys)
h5f.close()
def len(self):
return len(self.keys)
def getitem(self, index):
if self.train:
h5f = h5py.File('train.h5', 'r')
else:
h5f = h5py.File('val.h5', 'r')
key = self.keys[index]
data = np.array(h5f[key])
h5f.close()
return torch.Tensor(data)

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.