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 8th No.11】DrivAerNet++ 论文复现 #1062

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from

Conversation

LilaKen
Copy link
Contributor

@LilaKen LilaKen commented Jan 12, 2025

PR types

Others

PR changes

APIs、Docs

Describe

本PR的目标是复现RegPointNet网络,将DrivAerNet++处理成ppsci版API,并且加入对应的文档说明。

论文信息

年份 会议 作者 引用数 论文PDF
2024 Conference and Workshop on Neural Information Processing Systems (NeurIPS) Mohamed Elrefaie, Florin Morar, Angela Dai, Faez Ahmed 4 DrivAerNet++: A Large-Scale Multimodal Car Dataset with Computational Fluid Dynamics Simulations and Deep Learning Benchmarks

现结果

预训练模型 神经网络 指标
DragPrediction_DrivAerNet_PointNet_r2_batchsize16_200epochs_100kpoints_tsne_NeurIPS_best_model.pdparams RegPointNet $R^2: 92%$

Copy link

paddle-bot bot commented Jan 12, 2025

Thanks for your contribution!

@LilaKen
Copy link
Contributor Author

LilaKen commented Jan 12, 2025

@HydrogenSulfate @wangguan1995 麻烦两位飞桨导师检查下该PR。


DrivAerNet++: A Large-Scale Multimodal Car Dataset with Computational Fluid Dynamics Simulations and Deep Learning Benchmarks(DrivAerNet++:一个包含计算流体力学模拟和深度学习基准的大规模多模态汽车数据集)

## 论文信息:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个末尾的冒号可以删掉,另一个文档也是

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除


DrivAerNet++ 提供了一个用于汽车空气动力学性能预测的多模态数据集,任务目标是基于输入数据预测汽车的空气阻力系数($C_d$)。

##### 输入 :
Copy link
Collaborator

Choose a reason for hiding this comment

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

标题末尾的冒号请删除掉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除



def train(cfg: DictConfig):

Copy link
Collaborator

Choose a reason for hiding this comment

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

多余的空行删除

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除

Comment on lines 40 to 42
"input_keys": ("vertices",),
"label_keys": ("cd_value",),
"weight_keys": ("weight_keys",),
Copy link
Collaborator

Choose a reason for hiding this comment

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

请实用cfg的配置

Copy link
Contributor Author

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.

不太懂这里的意思

哦字打错了,是“使用”,就是这里不要用hard code的字符串,而是用cfg的属性

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已解决

Comment on lines 64 to 66
"input_keys": ("vertices",),
"label_keys": ("cd_value",),
"weight_keys": ("weight_keys",),
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已解决

Initialize the RegPointNet model for regression tasks with enhanced complexity,
including additional layers and residual connections.

Parameters:
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. docstring和现有代码保持一致,用Args而不是Parameters
  2. __init__的docstring移动到类下方

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

"""
Forward pass of the network.

Parameters:
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

x (Tensor): Input tensor of shape (batch_size, 3, num_points).

Returns:
Tensor: Output tensor of the predicted scalar value.
Copy link
Collaborator

Choose a reason for hiding this comment

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

返回值类型请写完整,paddle.Tensor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

normalized_data = (data - mean_vals) / std_vals
return normalized_data

def mean_normalize(self, data: paddle.Tensor) -> paddle.Tensor:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个函数有用到吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除

normalized_data = (data - min_vals) / (max_vals - min_vals)
return normalized_data

def z_score_normalize(self, data: paddle.Tensor) -> paddle.Tensor:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个函数有用到吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除

@HydrogenSulfate
Copy link
Collaborator

@LilaKen 有时间可以参考review建议,修改一下

@luotao1 luotao1 changed the title 【Hackathon 7th PPSCI No.3】NO.3 DrivAerNet++ 论文复现 【Hackathon 8th No.11】DrivAerNet++ 论文复现 Jan 14, 2025
@HydrogenSulfate
Copy link
Collaborator

@LilaKen commit时还麻烦再解决一下冲突

@HydrogenSulfate
Copy link
Collaborator

另外还有几个评论可能被缩进了,麻烦也看一下,
image

@LilaKen
Copy link
Contributor Author

LilaKen commented Jan 15, 2025

@LilaKen commit时还麻烦再解决一下冲突

已解决

@LilaKen
Copy link
Contributor Author

LilaKen commented Jan 15, 2025

另外还有几个评论可能被缩进了,麻烦也看一下, image

已解决

Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

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

另一个DrivAerNet文档也麻烦修改一下:

  1. 删除标题结尾冒号
    image
  2. 请处理重复的的3.2章节
    image

Comment on lines 197 to 198
Returns:
paddle.Tensor: Output tensor of the predicted scalar value.
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. 返回值类型不对
  2. forward缺少type hint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

Forward pass of the network.

Args:
x (Tensor): Input tensor of shape (batch_size, 3, num_points).
Copy link
Collaborator

Choose a reason for hiding this comment

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

paddle.Tensor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

f"Error loading point cloud from {load_path}: {e}"
) from e

def __getitem__(self, idx: int, apply_augmentations: bool = True):
Copy link
Collaborator

Choose a reason for hiding this comment

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

apply_augmentations这个参数没用到

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除

apply_augmentations (bool, optional): Whether to apply data augmentations. Defaults to True.

Returns:
Tuple[paddle.Tensor, paddle.Tensor]: The sample (point cloud) and its label (Cd value).
Copy link
Collaborator

Choose a reason for hiding this comment

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

返回值类型不对

Copy link
Contributor Author

Choose a reason for hiding this comment

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

修改为Tuple[Dict[str, np.ndarray], Dict[str, np.ndarray], Dict[str, np.ndarray]]:

2. **批次大小的影响**:
- 如果使用不同的批次大小(batch size),R² 的结果可能会显著不同。例如,较小的批次可能会导致更大的方差,从而影响 R² 的计算。因此,基于批次的 R² 计算结果依赖于批次大小的选择,缺乏稳定性。

```python
Copy link
Collaborator

Choose a reason for hiding this comment

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

```后面加一个空格,和其他地方保持一致

Copy link
Contributor Author

Choose a reason for hiding this comment

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

python和python格式化后还是```python

Copy link
Collaborator

Choose a reason for hiding this comment

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

整个文档是否能用 vscode 的markdown插件格式化一下?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已格式化

docs/zh/examples/drivaernetplusplus.md Show resolved Hide resolved
Comment on lines 127 to 132
self.subset_indices = self.data_frame[
self.data_frame["Design"].isin(subset_ids)
].index.tolist()
self.data_frame = self.data_frame.loc[self.subset_indices].reset_index(
drop=True
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

同,除打开文件外的操作请不要放到try内

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

mkdocs.yml Outdated
@@ -76,6 +76,8 @@ nav:
- tempoGAN: zh/examples/tempoGAN.md
- NSFNet4: zh/examples/nsfnet4.md
- ViV: zh/examples/viv.md
- DrivAerNet: zh/examples/drivaernet.md
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. DrivAerNet在69行已经有了
  2. DrivAerNetPlusPlus可以移动到70行

@HydrogenSulfate
Copy link
Collaborator

@LilaKen 有时间麻烦再改一下

@LilaKen
Copy link
Contributor Author

LilaKen commented Jan 16, 2025

@LilaKen 有时间麻烦再改一下

好的,可能需要过几天,手头上导师有些事情,我处理完把这个处理好,顺便也把DrivAerNet的重新pr更新一遍。

examples/drivaernetplusplus/drivaernetplusplus.py Outdated Show resolved Hide resolved
examples/drivaernetplusplus/drivaernetplusplus.py Outdated Show resolved Hide resolved
examples/drivaernetplusplus/drivaernetplusplus.py Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

本文件内无关内容包括缩进请不要改动,否则本地无法构建文档

Copy link
Contributor Author

Choose a reason for hiding this comment

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

收到

Comment on lines 206 to 231
# Ensure x is in the shape (bs, C, L)
if len(x.shape) != 3:
raise ValueError(
f"Input tensor should have shape (batch_size, C, L), but got {x.shape}"
)

# Initialize an empty list to store the processed samples
processed_samples = []

# Apply data augmentation and normalization for each sample in the batch
augmentation = DataAugmentation()
for i in range(bs):
sample = x[i].numpy() # Convert to numpy array for data augmentation
sample = augmentation.translate_pointcloud(sample)
sample = augmentation.jitter_pointcloud(sample)
sample = self.min_max_normalize(sample)
processed_samples.append(sample)

# Stack the processed samples back into a batch tensor
x_processed = paddle.to_tensor(np.stack(processed_samples, axis=0))

# Ensure the processed tensor has the same shape as the original input
if x_processed.shape != x.shape:
raise ValueError(
f"Processed tensor shape {x_processed.shape} does not match original input shape {x.shape}"
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

为什么要把数据增强代码写到模型前向里?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不好意思,之前找复现bug的时候挪动了一下,已经重新调回数据集加载py文件中。

Comment on lines 56 to 57
```python
# 源代码DeepSurrogates/train_RegPointNet.py中的R²计算
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个代码块不需要整体缩进4个空格吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已取消缩进

4. 启动 Globus Connect 个人版。由于第一次运行,因此必须先完成设置,然后才能运行完整的应用程序。

```sh
$ ./globusconnectpersonal
Copy link
Collaborator

Choose a reason for hiding this comment

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

sh命令里的美元符号建议删掉,全文检查一下

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除

Comment on lines 165 to 167
## 2. 问题定义

#### 2.1 数据集呈现
Copy link
Collaborator

Choose a reason for hiding this comment

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

二级标题后应该跟着的是三级标题,三个井号,文档整体检查一下标题级数的正确性

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改


为了预测汽车的空气阻力系数 ($C_d$),本研究采用基于深度学习的回归方法,使用两种点云处理模型 **RegDGCNN** 和 **RegPointNet**,分别从输入数据中提取几何特征并完成回归任务。这些模型能够高效处理 3D 点云数据,并结合设计参数,构建端到端的预测框架。

##### **1. RegDGCNN**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
##### **1. RegDGCNN**
1. RegDGCNN

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

docs/zh/examples/drivaernetplusplus.md Outdated Show resolved Hide resolved
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.

4 participants