CommissarMa / Context-Aware_Crowd_Counting-pytorch

The implementation of Context-Aware Crowd Counting(CVPR2019)
MIT License
68 stars 23 forks source link

请问训练中间后如何从断点开始? #3

Closed silencezx closed 5 years ago

silencezx commented 5 years ago

训练了多次以后,中断了,如何从断点开始训练呢?

CommissarMa commented 5 years ago

很抱歉,我在写代码的时候为了尽量简单,所以忽略了这个功能。如果你确实想要继续训练,可以自行编写相关代码,不难的,使用torch.load加载checkpoints文件夹下的最新的模型,然后继续训练即可。

CommissarMa commented 5 years ago

你可以看一下CSRNet的官方作者的代码,那个里面有从断点继续训练的代码。https://github.com/leeyeehoo/CSRNet-pytorch

silencezx commented 5 years ago

显示密度图的时候,以下代码 estimate_density_map(img_root,gt_dmap_root,model_param_path,3) 不屏蔽的时候去,就出现RuntimeError: cuda runtime error (2) : out of memory at c:\users\administrator\downloads\new-builder\win-wheel\pytorch\aten\src\thc\generic/THCStorage.cu:58

有什么办法可以直接显示密度图吗?谢谢

------------------ 原始邮件 ------------------ 发件人: "Ma Zhenwei"notifications@github.com; 发送时间: 2019年5月24日(星期五) 晚上6:14 收件人: "CommissarMa/Context-Aware_Crowd_Counting-pytorch"Context-Aware_Crowd_Counting-pytorch@noreply.github.com; 抄送: "沉默的不去辩解"408874078@qq.com;"Author"author@noreply.github.com; 主题: Re: [CommissarMa/Context-Aware_Crowd_Counting-pytorch] 请问训练中间后如何从断点开始? (#3)

你可以看一下CSRNet的官方作者的代码,那个里面有从断点继续训练的代码。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

CommissarMa commented 5 years ago

在estimate_density_map函数里面的for循环之前加上with torch.no_grad():应该就不会报错了。 我稍后修复一下这个bug,谢谢。

silencezx commented 5 years ago

训练了500次 ,MAE 70左右正常吗?大佬方便留个微信嘛,需要向大佬请教请教

------------------ 原始邮件 ------------------ 发件人: "Ma Zhenwei"notifications@github.com; 发送时间: 2019年5月24日(星期五) 晚上6:22 收件人: "CommissarMa/Context-Aware_Crowd_Counting-pytorch"Context-Aware_Crowd_Counting-pytorch@noreply.github.com; 抄送: "沉默的不去辩解"408874078@qq.com;"Author"author@noreply.github.com; 主题: Re: [CommissarMa/Context-Aware_Crowd_Counting-pytorch] 请问训练中间后如何从断点开始? (#3)

在estimate_density_map函数里面的for循环之前加上with torch.no_grad():应该就不会报错了。 我稍后修复一下这个bug,谢谢。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

yanfangfangfang commented 5 years ago

你好 请问您后来训练出mae 62 的结果了吗 原因在哪? 我现在跑了336次 最好的结果是第116次,mae 70左右

CommissarMa commented 5 years ago

从作者那里得到的技巧是图像要水平翻折,然后结果就从65到62.3了

yanfangfangfang commented 5 years ago

在另一个comment里面提到的 我们对于测试数据部分是不是 应该不使用水平翻转 而只是对train数据集做数据增强 我按这个想法再跑一遍 谢谢

CommissarMa commented 5 years ago

我已经更新了代码,现在训练是有水平翻折的,而测试时没有。

silencezx commented 5 years ago

我已经更新了代码,现在训练是有水平翻折的,而测试时没有。

part B的你有训练吗?我刚刚看了一下part A的最佳是 124次 MAE66.9

CommissarMa commented 5 years ago

@silencezx 有一个trick是有时候以为当前是最低的mae了,但过一会又会得到更低的点。对于Part B,使用多个batch_size会收敛的更快。