Skip to content

训练DTU数据的loss问题 #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Be997398715 opened this issue Jan 27, 2022 · 21 comments
Open

训练DTU数据的loss问题 #65

Be997398715 opened this issue Jan 27, 2022 · 21 comments

Comments

@Be997398715
Copy link

感谢作者的开源代码!我在尝试训练DTU数据时(新版训练和legacy训练),总是在patchmatchnet_loss函数中报错,报错信息如下:
File "/media/user/Data/patchmatchnet_improve/PatchmatchNet-main/models/net.py", line 341, in patchmatchnet_loss
loss = loss + F.smooth_l1_loss(depth[mask[i]], gt_depth, reduction="mean")
IndexError: The shape of the mask [2, 1, 84, 80] at index 2 does not match the shape of the indexed tensor [2, 1, 512, 640] at index 2
我查看了depth_patchmatch生成的4阶段结果维度,和mask与depth_gt的维度不一致,这个应该如何解决?

@FangjinhuaWang
Copy link
Owner

FangjinhuaWang commented Jan 27, 2022

Hi,

I am not maintaining this repo actively. Microsoft is the main contributor now. As I found, train.py creates scaled ground truth. The multi-scale groung truth seems like this: HxW, 1/2Hx1/2W, 1/4Hx1/4W, 1/8Hx1/8W. However, in the loss, depth_patchmatch has resolutions like this in sequence: 1/8Hx1/8W, 1/4Hx1/4W, 1/2Hx1/2W, HxW. So it is inverted. You can modify the function create_stage_images to output ground truth in a correct order. @anmatako, could you have a look?

@anmatako
Copy link

anmatako commented Feb 2, 2022

I will take a look once I'm able to find some time to get back to this wok. This issue is a bit surprising to me since I have tested quite a bit and not run into this. @Be997398715 have you followed the instructions about converting the DTU dataset to the newer format the PatchMatchNet is now using? Also, can you please provide more info on how you're calling the script and which data are being used?

@Jake0124
Copy link

Jake0124 commented Jun 7, 2022

@Be997398715 你好,我也遇到了相同的问题,请问你解决了吗?

@FangjinhuaWang
Copy link
Owner

Can you try with what I posted before in this thread: modify the function create_stage_images as:

def create_stage_images(image: torch.Tensor) -> List[torch.Tensor]:
    return [
        F.interpolate(image, scale_factor=0.125, mode="nearest"),
        F.interpolate(image, scale_factor=0.25, mode="nearest"),
        F.interpolate(image, scale_factor=0.5, mode="nearest"),
        image,
    ]

@Jake0124
Copy link

Jake0124 commented Jun 8, 2022

@FangjinhuaWang 你好,这种修改并没有解决问题,问题应该出在数据上;当我使用从你们的链接(https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35)中下载的DTU数据时,是可以正常训练的。

@lorelei616
Copy link

@Jake0124 哈喽,作者提供的链接下载不了了,同学能分享一下预处理后的数据集嘛~~~

@FangjinhuaWang
Copy link
Owner

@lorelei616 我检查了下,链接应该没问题

@IBelieve1234
Copy link

我也碰到了相同的问题,应该使用作者提供的数据集进行训练https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35。并且该链接不翻完全可以下载。

@Ttingyyy
Copy link

请问训练的结果是否正确呢? 我跑出来的结果都不太对,而且在测试时结果也存在问题

@IBelieve1234
Copy link

IBelieve1234 commented Mar 30, 2024 via email

@Ttingyyy
Copy link

没啥问题的,改了改之后跑通啦!

---原始邮件--- 发件人: @.> 发送时间: 2024年3月30日(周六) 中午1:27 收件人: @.>; 抄送: @.@.>; 主题: Re: [FangjinhuaWang/PatchmatchNet] 训练DTU数据的loss问题 (Issue #65) 请问训练的结果是否正确呢? 我跑出来的结果都不太对,而且在测试时结果也存在问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

请问你的环境配置时多少呀? 我用的8G显存和cuda11.3、pytorch1.13.0 跑是能跑的,但是测试结果是不对的

@IBelieve1234
Copy link

没啥问题的,改了改之后跑通啦!

---原始邮件--- 发件人: @.> 发送时间: 2024年3月30日(周六) 中午1:27 收件人: _@**._>; 抄送: _@.@._>; 主题: Re: [FangjinhuaWang/PatchmatchNet] 训练DTU数据的loss问题 (Issue #65) 请问训练的结果是否正确呢? 我跑出来的结果都不太对,而且在测试时结果也存在问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: _@_.*>

请问你的环境配置时多少呀? 我用的8G显存和cuda11.3、pytorch1.13.0 跑是能跑的,但是测试结果是不对的

RTX3090,时不时显存占到22G,我测试结果是正确的

@adong2023
Copy link

我也可以作者解决了相同的问题,应该使用提供的数据集进行训练[https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35。并且该链接不完全翻开下载。](https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35%E3%80%82%E5%B9%B6%E4%B8%94%E8%AF%A5%E9%93%BE%E6%8E%A5%E4%B8%8D%E7%BF%BB%E5%AE%8C%E5%85%A8%E5%8F%AF%E4%BB%A5%E4%B8%8B%E8%BD%BD%E3%8
同学你好 可以提供一下数据集的下载链接吗 源链接失效了

@adong2023
Copy link

@FangjinhuaWang你好,这种修改并没有解决问题,问题应该出在数据上;当我使用从你们的链接(https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35)中下载的DTU数据时,是可以正常训练的。
同学你好可以提供一下数据集的下载链接吗 源链接失效了

@IBelieve1234
Copy link

@FangjinhuaWang你好,这种修改并没有解决问题,问题应该出在数据上;当我使用从你们的链接(https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35)中下载的DTU数据时,是可以正常训练的。
同学你好可以提供一下数据集的下载链接吗 源链接失效了

原链接没有失效啊,就这个直接打开点一下就下载https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35

@Tz7311
Copy link

Tz7311 commented Apr 9, 2025

@FangjinhuaWang你好,这种修改并没有解决问题,问题应该出在数据上;当我使用从你们的链接(https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35)中下载的DTU数据时,是可以正常训练的。
同学你好可以提供一下数据集的下载链接吗 源链接失效了

原链接没有失效啊,就这个直接打开点一下就下载https://polybox.ethz.ch/index.php/s/ugDdJQIuZTk4S35

你好,请问你当时完成matlab评估了吗?我在评估时会用非常多的时间而且最后都报错内存不足,不知道到底是为什么。不过我用的windows,是必须在ubuntu上评估数据集吗?

@Tz7311
Copy link

Tz7311 commented Apr 9, 2025

没啥问题的,改了改之后跑通啦!

---原始邮件--- 发件人: @.> 发送时间: 2024年3月30日(周六) 中午1:27 收件人: _@**._>; 抄送: _@.@._>; 主题: Re: [FangjinhuaWang/PatchmatchNet] 训练DTU数据的loss问题 (Issue #65) 请问训练的结果是否正确呢? 我跑出来的结果都不太对,而且在测试时结果也存在问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: _@_.*>

请问你的环境配置时多少呀? 我用的8G显存和cuda11.3、pytorch1.13.0 跑是能跑的,但是测试结果是不对的

你好,请问你当时完成matlab评估了吗?我在评估时会用非常多的时间而且最后都报错内存不足,不知道到底是为什么。不过我用的windows,是必须在ubuntu上评估数据集吗?

@IBelieve1234
Copy link

IBelieve1234 commented Apr 9, 2025 via email

@Tz7311
Copy link

Tz7311 commented Apr 9, 2025

不是非要在Linux上跑的,我就在windows上跑出来了

---原始邮件---
发件人: @.>
发送时间: 2025年4月9日(周三) 上午9:52
收件人: @.
>;
抄送: @.@.>;
主题: Re: [FangjinhuaWang/PatchmatchNet] 训练DTU数据的loss问题 (Issue #65)

没啥问题的,改了改之后跑通啦!

---原始邮件--- 发件人: @.> 发送时间: 2024年3月30日(周六) 中午1:27 收件人: @**.>; 抄送: @.**@._>; 主题: Re: [FangjinhuaWang/PatchmatchNet] 训练DTU数据的loss问题 (Issue #65) 请问训练的结果是否正确呢? 我跑出来的结果都不太对,而且在测试时结果也存在问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

请问你的环境配置时多少呀? 我用的8G显存和cuda11.3、pytorch1.13.0 跑是能跑的,但是测试结果是不对的

你好,请问你当时完成matlab评估了吗?我在评估时会用非常多的时间而且最后都报错内存不足,不知道到底是为什么。不过我用的windows,是必须在ubuntu上评估数据集吗?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>
Tz7311 left a comment (FangjinhuaWang/PatchmatchNet#65)

没啥问题的,改了改之后跑通啦!

---原始邮件--- 发件人: @.> 发送时间: 2024年3月30日(周六) 中午1:27 收件人: @**.>; 抄送: @.**@._>; 主题: Re: [FangjinhuaWang/PatchmatchNet] 训练DTU数据的loss问题 (Issue #65) 请问训练的结果是否正确呢? 我跑出来的结果都不太对,而且在测试时结果也存在问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

请问你的环境配置时多少呀? 我用的8G显存和cuda11.3、pytorch1.13.0 跑是能跑的,但是测试结果是不对的

你好,请问你当时完成matlab评估了吗?我在评估时会用非常多的时间而且最后都报错内存不足,不知道到底是为什么。不过我用的windows,是必须在ubuntu上评估数据集吗?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>

谢谢您的回复
方便询问您的设备内存等情况吗?我也只是按照项目要求更改了数据路径,现在正在用的搭配了两张120GB的4090,cpu也有192GB,运行时也会192GB直接拉满,很长一段时间之后就报错内存不足。
路径设置大概为 datapth='F:/SampleSet/MVSData/'
在网上看了很多帖子,比较多的回答是检查路径是否正确,我的路径应该是没有问题的吧?

@IBelieve1234
Copy link

IBelieve1234 commented Apr 9, 2025 via email

@Tz7311
Copy link

Tz7311 commented Apr 9, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants