Skip to content
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

【Hackathon 5th No.61】Skillful nowcasting of extreme precipitation with NowcastNet #593

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented Oct 23, 2023

PR types

Others

PR changes

Others

Describe

No.61:Skillful nowcasting of extreme precipitation with NowcastNet

论文链接:
https://www.nature.com/articles/s41586-023-06184-4#Abs1

参考代码链接:
https://codeocean.com/capsule/3935105/tree/v1

RFC PaddlePaddle/community#705

使用预训练模型生成图

torch测试图
image

paddle测试图
image

运行命令

python nowcastnet.py CASE_TYPE=normal
python nowcastnet.py CASE_TYPE=large

预训练模型和数据集下载

链接:https://pan.baidu.com/s/191_Z7IT07RZ86BlK6AHkGA?pwd=x33b 
提取码:x33b 

@paddle-bot
Copy link

paddle-bot bot commented Oct 23, 2023

Thanks for your contribution!

examples/nowcastnet/loader.py Outdated Show resolved Hide resolved
examples/nowcastnet/convert_checkpoints.py Outdated Show resolved Hide resolved
examples/nowcastnet/mrms_case_test.sh Outdated Show resolved Hide resolved
examples/nowcastnet/mrms_large_case_test.sh Outdated Show resolved Hide resolved
examples/nowcastnet/run Outdated Show resolved Hide resolved
examples/nowcastnet/run.py Outdated Show resolved Hide resolved
ppsci/arch/nowcastnet.py Outdated Show resolved Hide resolved
examples/nowcastnet/run.py Outdated Show resolved Hide resolved
examples/nowcastnet/run.py Outdated Show resolved Hide resolved
ppsci/data/dataset/radar_dataset.py Show resolved Hide resolved
ppsci/data/dataset/radar_dataset.py Outdated Show resolved Hide resolved
ppsci/arch/nowcastnet.py Show resolved Hide resolved
ppsci/arch/nowcastnet.py Outdated Show resolved Hide resolved
input_frames = frames[:, : self.input_length]
input_frames = input_frames.reshape((batch, self.input_length, height, width))
# Evolution Network
intensity, motion = self.evo_net(input_frames)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现推理结果的图片与参考代码的有些差异,应该是某处没有对齐导致的,我这边帮忙查了下发现这个网络给定相同输入时输出存在2e-4左右的差异,需要在详细查一下,修改后建议再对整个网络整体检查下对齐情况

Copy link
Contributor Author

@co63oc co63oc Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

从其他模型复现遇到的问题比较,可能是初始化随机数不同结果有差异,如果是网络问题会模型不能运行或结果差异会较大。
模型是按源码复现的,那如果不大明确,就不在这上面花时间了

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前情况:paddle的grid_sample的CPU结果跟torch的GPU结果能对齐,GPU结果跟torch的CPU结果能对齐,但是把这个运算改到cpu上,后面仍然有没对齐的地方。by @HydrogenSulfate @zhiminzhang0830

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面仍然有没对齐

@luotao1 @HydrogenSulfate 这边check过了,后面没对齐仍然是grid_sample的问题,这个PR除了grid_sample外基本OK了,还有几处格式问题需要辛苦 @co63oc 再优化一下就可以合入了。

docs/zh/examples/nowcastnet.md Outdated Show resolved Hide resolved
docs/zh/examples/nowcastnet.md Outdated Show resolved Hide resolved
docs/zh/examples/nowcastnet.md Show resolved Hide resolved
ppsci/arch/nowcastnet.py Outdated Show resolved Hide resolved


class Generative_Decoder(paddle.nn.Layer):
def __init__(self, opt):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generative_Decoder 可以直接改为使用多个入参么,类似这样
def __init__(self, ngf, evo_ic, gen_oc, ic_feature):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他子层需要使用opt,如果拆开其他子层也要拆开,代码参数变量较多

ppsci/arch/nowcastnet.py Outdated Show resolved Hide resolved
ppsci/arch/nowcastnet.py Show resolved Hide resolved
ppsci/visualize/radar.py Outdated Show resolved Hide resolved
ppsci/visualize/radar.py Outdated Show resolved Hide resolved
ppsci/visualize/radar.py Outdated Show resolved Hide resolved
@zhiminzhang0830
Copy link
Collaborator

NowCastNet需要用到 OpenCV, 需要在requirements.txt里添加该库 opencv-python

@co63oc
Copy link
Contributor Author

co63oc commented Nov 14, 2023

NowCastNet需要用到 OpenCV, 需要在requirements.txt里添加该库 opencv-python

已修改

docs/zh/api/data/dataset.md Show resolved Hide resolved
docs/zh/examples/nowcastnet.md Show resolved Hide resolved
docs/zh/examples/nowcastnet.md Show resolved Hide resolved
docs/zh/examples/nowcastnet.md Show resolved Hide resolved
docs/zh/examples/nowcastnet.md Outdated Show resolved Hide resolved
docs/zh/examples/nowcastnet.md Outdated Show resolved Hide resolved
docs/zh/examples/nowcastnet/gt.gif Outdated Show resolved Hide resolved
ppsci/visualize/radar.py Show resolved Hide resolved
Copy link
Collaborator

@zhiminzhang0830 zhiminzhang0830 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhiminzhang0830 zhiminzhang0830 merged commit 602bfc0 into PaddlePaddle:develop Nov 14, 2023
3 checks passed
@co63oc co63oc deleted the nowcastnet branch December 12, 2023 12:14
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants