GithubHelp home page GithubHelp logo

Comments (6)

ChengxiHAN avatar ChengxiHAN commented on July 21, 2024

确实修改过哈,我想想看怎么解决。

from hanet-cd.

ChengxiHAN avatar ChengxiHAN commented on July 21, 2024

你也可以先训练几个epoch,看看能否测试。

from hanet-cd.

money6651626 avatar money6651626 commented on July 21, 2024

如果您方便的话可以直接提供HAN的训练权重pth,因为我看在open-cd的复现中直接引用了该类,这应该是您的最终版本),如果这是您论文上指标用的模型。(我相信在您的设备上应该是能够正确测试的,您通过torch.save(model.state_dict())的方式来重新保存权重,我通过torch.load_state_dict(torch.load("pth"))的方式直接按照键值对加载权重,这样不会受目录结构影响)

from hanet-cd.

work1-shekhaman avatar work1-shekhaman commented on July 21, 2024

@ChengxiHAN, did you found out, how to solve it, i am still facing this issue

from hanet-cd.

ChengxiHAN avatar ChengxiHAN commented on July 21, 2024

@ChengxiHAN, did you found out, how to solve it, i am still facing this issue

sorry, bro, it needs you to train HANet again. I haven't solved the problem yet.

from hanet-cd.

work1-shekhaman avatar work1-shekhaman commented on July 21, 2024

@ChengxiHAN, did you found out, how to solve it, i am still facing this issue

sorry, bro, it needs you to train HANet again. I haven't solved the problem yet.

If I train the model with batch size 4, predictions are in shape of (4,2,256,256) (for image size of (256,256))

Shape of tensor of predictions: torch.Size([4, 2, 256, 256])
Shape of tensor of target: torch.Size([1, 256, 256])
epoch 0 info 0 - 4: 0%| | 0/1245 [00:01<?, ?it/s]
Traceback (most recent call last):
File "trainHCX.py", line 157, in
cd_loss = criterion(cd_preds, labels)
File "/root/anaconda3/envs/hanet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/mnt/c/Users/91635/Desktop/Elm/gitrepo/HANet-CD-main/HANet-CD-main/utils/losses.py", line 96, in forward
bce = self.focal(predictions[0], target)
File "/root/anaconda3/envs/hanet/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/mnt/c/Users/91635/Desktop/Elm/gitrepo/HANet-CD-main/HANet-CD-main/utils/losses.py", line 40, in forward
logpt = logpt.gather(1, target)
RuntimeError: Size does not match at dimension 0 expected index [262144, 1] to be smaller than self [512, 256] apart from dimension 1

from hanet-cd.

Related Issues (5)

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.