Coder Social home page Coder Social logo

Comments (14)

sooperset avatar sooperset commented on May 20, 2024 4

@ZhangYuef Thanks for sharing!
Not sure why this error is popped up like

model = DexiNet()
model.load_state_dict(torch.load('24_model.pth'))

RuntimeError Traceback (most recent call last)
in
1 model = DexiNet()
----> 2 model.load_state_dict(checkpoint)
3 print('done')

/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
1043 if len(error_msgs) > 0:
1044 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
-> 1045 self.class.name, "\n\t".join(error_msgs)))
1046 return _IncompatibleKeys(missing_keys, unexpected_keys)
1047

RuntimeError: Error(s) in loading state_dict for DexiNet:
size mismatch for dblock_3.denselayer1.conv1.weight: copying a param with shape torch.Size([256, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]).
size mismatch for dblock_3.denselayer2.conv1.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
size mismatch for dblock_4.denselayer1.conv1.weight: copying a param with shape torch.Size([512, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 256, 1, 1]).
size mismatch for dblock_4.denselayer2.conv1.weight: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for dblock_4.denselayer3.conv1.weight: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for dblock_5.denselayer1.conv1.weight: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for dblock_5.denselayer2.conv1.weight: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for dblock_5.denselayer3.conv1.weight: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 1, 1]).
size mismatch for dblock_6.denselayer1.conv1.weight: copying a param with shape torch.Size([256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 512, 1, 1]).
size mismatch for dblock_6.denselayer2.conv1.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).
size mismatch for dblock_6.denselayer3.conv1.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 1, 1]).

But, I changed the first convolution layer of _DenseLayer with kernel=3 and padding=1, then I could successfully load the checkpoint.

class _DenseLayer(nn.Sequential):
    def __init__(self, input_features, out_features):
        super(_DenseLayer, self).__init__()

        # self.add_module('relu2', nn.ReLU(inplace=True)),
        self.add_module('conv1', nn.Conv2d(input_features, out_features,
                                           kernel_size=3, stride=1, padding=1, bias=True)),
        self.add_module('norm1', nn.BatchNorm2d(out_features)),
        self.add_module('relu1', nn.ReLU(inplace=True)),
        self.add_module('conv2', nn.Conv2d(out_features, out_features,
                                           kernel_size=3, stride=1, padding=1, bias=True)),
        self.add_module('norm2', nn.BatchNorm2d(out_features))
        # double check the norm1 comment if necessary and put norm after conv2

    def forward(self, x):
        x1, x2 = x
        # maybe I should put here a RELU
        new_features = super(_DenseLayer, self).forward(F.relu(x1))  # F.relu()
        return 0.5 * (new_features + x2), x2

Cap 2020-10-29 12-44-14-748

from dexined.

ZhangYuef avatar ZhangYuef commented on May 20, 2024 3

This is a checkpoint from epoch 24 trained on BIPED dataset. Download link is here.
Training result is as the following:
results
Hope this unofficial one can help : )

i have placed this file in checkpoint folder and in 24/ i am getting this error

Error(s) in loading state_dict for DexiNed:
Missing key(s) in state_dict: "block_cat.conv.weight", "block_cat.conv.bias", "block_cat.bn.weight", "block_cat.bn.bias", "block_cat.bn.running_mean", "block_cat.bn.running_var".
Unexpected key(s) in state_dict: "block_cat.weight", "block_cat.bias".

Sorry to forget mention, this checkpoint is trained based on the model of commit a9f6ade. Link from here.

from dexined.

xavysp avatar xavysp commented on May 20, 2024

Hi @LionXFQ sorry I will update the DexiNed-Pytorch weights soon, I am preparing the DexiNed extension in pytorch version

from dexined.

ZhangYuef avatar ZhangYuef commented on May 20, 2024

Also looking forward to the pretrained weights for Pytorch model.

from dexined.

Palzer avatar Palzer commented on May 20, 2024

+1 here too.

from dexined.

xavysp avatar xavysp commented on May 20, 2024

Sorry guys it will take a little longer, I cannot turn on my PC in the LAB, working remotely. But hope solve this issue in the coming days and update the DexiNed-Pytorch checkpoint

Cheers.

Xavier

from dexined.

ZhangYuef avatar ZhangYuef commented on May 20, 2024

Sorry guys it will take a little longer, I cannot turn on my PC in the LAB, working remotely. But hope solve this issue in the coming days and update the DexiNed-Pytorch checkpoint

Cheers.

Xavier

I have trained one on BIPED dataset myself. I can share if it may help anyone.

from dexined.

anandhu1436 avatar anandhu1436 commented on May 20, 2024

Sorry guys it will take a little longer, I cannot turn on my PC in the LAB, working remotely. But hope solve this issue in the coming days and update the DexiNed-Pytorch checkpoint
Cheers.
Xavier

I have trained one on BIPED dataset myself. I can share if it may help anyone.

please share

from dexined.

ZhangYuef avatar ZhangYuef commented on May 20, 2024

This is a checkpoint from epoch 24 trained on BIPED dataset. Download link is here.

BTW, this checkpoint is trained based on the model of commit. Link here.

Training result is as the following:
results

Hope this unofficial one can help : )

from dexined.

anandhu1436 avatar anandhu1436 commented on May 20, 2024

This is a checkpoint from epoch 24 trained on BIPED dataset. Download link is here.

Training result is as the following:
results

Hope this unofficial one can help : )

i have placed this file in checkpoint folder and in 24/ i am getting this error

Error(s) in loading state_dict for DexiNed:
Missing key(s) in state_dict: "block_cat.conv.weight", "block_cat.conv.bias", "block_cat.bn.weight", "block_cat.bn.bias", "block_cat.bn.running_mean", "block_cat.bn.running_var".
Unexpected key(s) in state_dict: "block_cat.weight", "block_cat.bias".

from dexined.

ZhangYuef avatar ZhangYuef commented on May 20, 2024

Thanks @soomiles for pointing out ! I did change the model layer as you point out as the official code had dimension error at that time. : )

Let's wait for the official one!

from dexined.

priyamdey avatar priyamdey commented on May 20, 2024

Hi. Is the official PyTorch pretrained model available yet?

from dexined.

xavysp avatar xavysp commented on May 20, 2024

Hi. Is the official PyTorch pretrained model available yet?

Hi sorry, now you can find the official one.

from dexined.

ManuBN786 avatar ManuBN786 commented on May 20, 2024

Sorry guys it will take a little longer, I cannot turn on my PC in the LAB, working remotely. But hope solve this issue in the coming days and update the DexiNed-Pytorch checkpoint
Cheers.
Xavier

I have trained one on BIPED dataset myself. I can share if it may help anyone.

Please do. and send the link. Thanks

from dexined.

Related Issues (20)

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.