diff --git a/MindElec/NOTICE b/MindElec/NOTICE index 41553f38a92e4797e121dcb3bdce8e3e085f5368..b38f95bde9e99aa4eb7bf9e0c6b489748e614331 100644 --- a/MindElec/NOTICE +++ b/MindElec/NOTICE @@ -1,3 +1,3 @@ -MindSpore MindELec +MindSpore MindElec Copyright 2019-2021 Huawei Technologies Co., Ltd diff --git a/MindElec/README_CN.md b/MindElec/README_CN.md index 5231b127868019f32f4f2c5e071aa481e3e4af59..6635433f675354bab7d37ae3ca05c7dbbd32a029 100644 --- a/MindElec/README_CN.md +++ b/MindElec/README_CN.md @@ -28,7 +28,7 @@ ## MindElec介绍 -电磁仿真是指通过计算的方式模拟电磁波在物体或空间中的传播特性,其在手机容差、天线优化和芯片设计等场景中应用广泛。传统数值方法如有限差分、有限元等需网格剖分、迭代计算,仿真流程复杂、计算时间长,无法满足产品的设计需求。AI方法具有万能逼近能力和高效推理能力,可有效提升仿真效率。 +电磁仿真是指通过计算的方式模拟电磁波在物体或空间中的传播特性,其在手机容差、天线优化和芯片设计等场景中应用广泛。传统数值方法如有限差分、有限元等需网格剖分、迭代计算,仿真流程复杂、计算时间长,无法满足产品的设计需求。AI方法具有万能逼近和高效推理能力,可有效提升仿真效率。 MindElec是基于MindSpore开发的AI电磁仿真工具包,由数据构建及转换、仿真计算、以及结果可视化组成。可以支持端到端的AI电磁仿真。目前已在华为终端手机容差场景中取得阶段性成果,相比商业仿真软件,AI电磁仿真的S参数误差在2%左右,端到端仿真速度提升10+倍。 @@ -53,7 +53,7 @@ MindElec是基于MindSpore开发的AI电磁仿真工具包,由数据构建及 ### 结果可视化 -仿真的结果如S参数或电磁场等可保存在CSV、VTK文件中。MindInsight可以显示训练过程中的损失函数变化,并以图片的形式在网页上展示结果;Paraview是第三方开源软件,可动态展示切片、翻转等高级功能。 +仿真的结果如S参数或电磁场等可保存在CSV、VTK文件中。MindInsight可以显示训练过程中的损失函数变化,并以图片的形式在网页上展示结果;Paraview是第三方开源软件,具有动态展示切片、翻转等高级功能。 ## 安装教程 @@ -76,7 +76,7 @@ MindElec是基于MindSpore开发的AI电磁仿真工具包,由数据构建及 pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/{version}/mindscience/{arch}/mindscience_mindelec_ascend-{version}-{python_version}-linux_{arch}.whl -i https://pypi.tuna.tsinghua.edu.cn/simple ``` -> - 在联网状态下,安装whl包时会自动下载MindElec安装包的依赖项(依赖项详情参见[setup.py](https://gitee.com/mindspore/mindscience/blob/master/MindElec/setup.py)),点云数据采样依赖[pythonocc](https://github.com/tpaviot/pythonocc-core), 需自行安装。 +> - 在联网状态下,安装whl包时会自动下载MindElec安装包的依赖项(依赖项详情参见[setup.py](https://gitee.com/mindspore/mindscience/blob/master/MindElec/setup.py)),点云数据采样依赖[pythonocc](https://github.com/tpaviot/pythonocc-core),需自行安装。 > - `{version}`表示MindElec版本号,例如下载0.1.0版本MindElec时,`{version}`应写为0.1.0。 > - `{arch}`表示系统架构,例如使用的Linux系统是x86架构64位时,`{arch}`应写为x86_64。如果系统是ARM架构64位,则写为aarch64。 > - `{python_version}`表示用户的Python版本,Python版本为3.7.5时,{python_version}应写为cp37_cp37m。Python版本为3.9.0时,则写为cp39_cp39。 diff --git a/MindElec/RELEASE.md b/MindElec/RELEASE.md index d709e07754372074ea345208e6f170991ce8e6ac..fb5a3191988fa324eebab5c431d1c5445c59578c 100644 --- a/MindElec/RELEASE.md +++ b/MindElec/RELEASE.md @@ -1,6 +1,6 @@ # MindElec 0.1.0 Release Notes -Initial release of MindELec. +Initial release of MindElec. ## Major Features @@ -15,4 +15,4 @@ Thanks goes to these wonderful people: yufan, wangzidong, yangkang, lujiale, shibeiji, liuhongsheng, liyang, wengbingya, chuhaotian, huangxiang, wangmin -Contributions of any kind are welcome! \ No newline at end of file +Contributions of any kind are welcome! diff --git a/MindElec/examples/README.md b/MindElec/examples/README.md index 980b183179797828c45e5c24d11d13d419df4f5e..88379ca9af138bd1e343f4454c6c2c7d70f8efb1 100644 --- a/MindElec/examples/README.md +++ b/MindElec/examples/README.md @@ -8,6 +8,6 @@ - [Full Electromagnetic Field Computation](./data_driven/pointcloud/full_em) - [Scattering Parameters Prediction](./data_driven/pointcloud/S_parameter) - [Physics Driven Approach](./physics_driven) - - [Solving Time Domain Maxwell](./physics_driven/time_domain_maxwell) - - [Solving Frequency Domain Maxwell](./physics_driven/frequency_domain_maxwell) - - [Incremental Learning For Solving Maxwell Equation Set](./physics_driven/incremental_learning) + - [Solving Time Domain Maxwell's Equations](./physics_driven/time_domain_maxwell) + - [Solving Frequency Domain Maxwell's Equations](./physics_driven/frequency_domain_maxwell) + - [Incremental Training for Solving a Family of Maxwell's Equations](./physics_driven/incremental_learning) diff --git a/MindElec/examples/data_driven/parameterization/README.md b/MindElec/examples/data_driven/parameterization/README.md index 2199f7540543a50b97ecc053d2bfc4c9d3419e70..630ed00e49885161ef72f199b6a2fbe397ed37c4 100644 --- a/MindElec/examples/data_driven/parameterization/README.md +++ b/MindElec/examples/data_driven/parameterization/README.md @@ -19,7 +19,7 @@ # **Parameterized Electromagnetic Simulation** -In some scenarios of electromagnetic simulation (such as tolerance evaluation), the structure can be described by a set of parameters. These parameters can be used as the input of neural network to simulate the scattering parameters of different structures. This section describes how to use MindElec to simulate the scattering parameters of antennas and mobile phones. For details, see the parametrized electromagnetic simulation tutorial. +In some scenarios of electromagnetic simulation (such as tolerance evaluation), the structure can be described by a set of parameters. These parameters can be used as the input of neural network to simulate the scattering parameters of different structures. This section describes how to use parameterized electromagnetic simulation method of MindElec to calculate the scattering parameters of antennas and mobile phones. For details, see the parametrized electromagnetic simulation tutorial. # **Model Architecture** @@ -27,7 +27,7 @@ The following figure shows the network architecture of the parametrized electrom ![network_architecture](./docs/network_architecture_en.jpg) -The network inputs are the changed parameters, and the output is the S11 parameter of each frequency. +The network inputs are the changed parameters, and the output is the S11 parameter of each frequency (S11 is the only component of scattering parameter in single port scenario). # **Datasets** diff --git a/MindElec/examples/data_driven/parameterization/README_CN.md b/MindElec/examples/data_driven/parameterization/README_CN.md index 98b3041e06db721d2bbb80b6bf7cf565ac3496a5..c27e29393f46c57bd19e3cafaf16eca4ecb645aa 100644 --- a/MindElec/examples/data_driven/parameterization/README_CN.md +++ b/MindElec/examples/data_driven/parameterization/README_CN.md @@ -15,7 +15,7 @@ # 参数化电磁仿真 -电磁仿真的某些场景(如容差评估)中,目标结构可以用一组参数描述,将这些参数作为神经网络的输入可以仿真不同目标结构的散射参数。本案例介绍如何通过MindElec仿真天线和手机的散射参数,详细信息可以参考参数化电磁仿真教程。 +电磁仿真的某些场景(如容差评估)中,目标结构可以用一组参数描述,将这些参数作为神经网络的输入可以仿真不同目标结构的散射参数。本案例介绍如何通过MindElec参数化方法仿真天线和手机的散射参数,详细信息可以参考参数化电磁仿真教程。 # 模型架构 @@ -23,7 +23,7 @@ ![network_architecture](./docs/network_architecture_ch.jpg) -网络输入为变化的参数,网络输出为各个频点下的S11参数。 +网络输入为变化的参数,网络输出为各个频点下的S11参数(单端口场景下散射参数只有S11)。 # 数据集 @@ -36,9 +36,9 @@ - 硬件(Ascend) - 准备Ascend处理器搭建硬件环境。 - 框架 - - [MindELec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) + - [MindElec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) - 如需查看详情,请参见如下资源: - - [MindELec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) + - [MindElec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) - [MindElec Python API](https://www.mindspore.cn/mindscience/api/zh-CN/master/mindelec.html) # 脚本说明 diff --git a/MindElec/examples/data_driven/pointcloud/data_compression/README.md b/MindElec/examples/data_driven/pointcloud/data_compression/README.md index a803b42122219d4d21d113ed604c9af587e7117b..09dcd34998ce58f882b5dba9302508b5dbb5cef1 100644 --- a/MindElec/examples/data_driven/pointcloud/data_compression/README.md +++ b/MindElec/examples/data_driven/pointcloud/data_compression/README.md @@ -20,7 +20,7 @@ When you use point cloud data to calculate scatter parameters, if the target architecture is too complex or the modification of structure is too fine, the resolution of the point cloud data needs to be set to a high value to ensure the validity of the point cloud data. However, a high resolution may lead to the problem that a single piece of data is too large. For example, a single point cloud data in this scenario consists of hundreds of millions of points. The deep learning based simulation method requires a large amount of memory and computing power to process such data, and its efficiency is also reduced. -To solve this problem, we propose a neural network-based compression model to compress the original point cloud data by blocks. The compression process consists of two steps: self-supervised training of the compression model and block-wise data compression. +To solve this problem, MindElec proposes a neural network-based compression model to compress the original point cloud data by blocks. This tool can greatly reduce the storage and computation cost of point cloud based AI simulation method, improve its generality and efficiency. ## **Self-supervised Training of the Compression Model** diff --git a/MindElec/examples/data_driven/pointcloud/data_compression/README_CN.md b/MindElec/examples/data_driven/pointcloud/data_compression/README_CN.md index e2fdc9c3e19e892838c24cc5dd4a178b852a5cc9..020ab9ed1cb75f20bed683855a0b6b56a8ff5b34 100644 --- a/MindElec/examples/data_driven/pointcloud/data_compression/README_CN.md +++ b/MindElec/examples/data_driven/pointcloud/data_compression/README_CN.md @@ -18,9 +18,9 @@ # 点云数据压缩 -使用点云数据计算散射参数时,如果目标体系结构复杂或结构调整比较精细,点云数据的分辨率需要设置得非常高才能保证点云数据的有效性;但同时,分辨率高会导致单条数据过大的问题,以手机仿真计算为例,该场景中单条点云数据通常包含上亿个点,深度仿真计算方法处理这种数据需要大量的显存与算力,通用醒与高效性也会降低。 +使用点云数据计算散射参数时,如果目标体系结构复杂或结构调整比较精细,点云数据的分辨率需要设置得非常高才能保证点云数据的有效性;但同时,分辨率高会导致单条数据过大的问题,以手机仿真计算为例,该场景中单条点云数据通常包含上亿个点,深度仿真计算方法处理这种数据需要大量的显存与算力,通用性与高效性也会降低。 -针对该问题我们提出使用基于神经网络的压缩模型对原始点云数据做分块压缩,该压缩流程分为压缩模型自监督训练与数据分块压缩两步: +针对该问题MindElec提供基于神经网络的分块压缩工具,该工具可以大幅降低点云数据方案的显存与算力消耗,提升基于点云数据AI仿真方案的通用性与高效性。 ## 压缩模型自监督训练 @@ -44,9 +44,9 @@ - 硬件(Ascend) - 准备Ascend处理器搭建硬件环境。 - 框架 - - [MindELec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) + - [MindElec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) - 如需查看详情,请参见如下资源: - - [MindELec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) + - [MindElec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) - [MindElec Python API](https://www.mindspore.cn/mindscience/api/zh-CN/master/mindelec.html) # 脚本说明 diff --git a/MindElec/examples/data_driven/pointcloud/full_em/README_CN.md b/MindElec/examples/data_driven/pointcloud/full_em/README_CN.md index 11cfbad90081bddd284375fbba28fdd84dc6ce61..1da3eec6c6a1197911b4c6344e33149af48c5477 100644 --- a/MindElec/examples/data_driven/pointcloud/full_em/README_CN.md +++ b/MindElec/examples/data_driven/pointcloud/full_em/README_CN.md @@ -18,16 +18,20 @@ # 数据集 -基于[点云数据生成](https://gitee.com/mindspore/mindscience/tree/master/MindElec/examples/data_driven/pointcloud/generate_pointcloud)和[点云数据压缩](https://gitee.com/mindspore/mindscience/tree/master/MindElec/examples/data_driven/pointcloud/data_compression)生成电磁场输入数据,再调用`src/inputs_process.py`将输入数据绑定坐标和源位置信息。而标签数据需要使用商业仿真软件或者时域有限差分算法生成,再调用`src/label_process.py`处理得到最终的标签。我们训练过程中使用的手机数据涉及商业机密,所以无法对外展示,可以使用`src/sample.py`脚本生成随机数据用于模型功能验证。 +基于[点云数据生成](https://gitee.com/mindspore/mindscience/tree/master/MindElec/examples/data_driven/pointcloud/generate_pointcloud)和[点云数据压缩](https://gitee.com/mindspore/mindscience/tree/master/MindElec/examples/data_driven/pointcloud/data_compression)生成电磁场输入数据,再调用`src/inputs_process.py`将输入数据绑定坐标和源位置信息。 + +标签数据需要使用商业仿真软件或者时域有限差分算法生成,再调用`src/label_process.py`处理得到最终的标签。 + +我们训练过程中使用的手机数据涉及商业机密,所以无法对外展示,可以使用`src/sample.py`脚本生成随机数据用于模型功能验证。 # 环境要求 - 硬件(Ascend) - 准备Ascend处理器搭建硬件环境。 - 框架 - - [MindELec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) + - [MindElec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) - 如需查看详情,请参见如下资源: - - [MindELec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) + - [MindElec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) - [MindElec Python API](https://www.mindspore.cn/mindscience/api/zh-CN/master/mindelec.html) # 快速入门 diff --git a/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README.md b/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README.md index 93cb6ed85d049519df8a5897ae84a586ad28c91e..ed6a6eec0ee956f986d81d80d4daf31eb1ab57cf 100644 --- a/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README.md +++ b/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README.md @@ -49,7 +49,7 @@ The STP file cannot be directly used as the input of the neural network. It need ## **Exporting json and stp Files** -```python +```shell python export_stp.py --cst_path CST_PATH --stp_path STP_PATH --json_path JSON_PATH @@ -59,7 +59,7 @@ In the preceding command, `cst_path` specifies the path of the CST file to be ex ## **Generating Point Cloud Data** -```python +```shell python generate_cloud_point.py --stp_path STP_PATH --json_path JSON_PATH --material_dir MATERIAL_DIR diff --git a/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README_CN.md b/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README_CN.md index 5df28e05aa11f2ea7d3940cbe326f1a682c29568..0800df493995a043cb301136ca0f9974b376ec2e 100644 --- a/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README_CN.md +++ b/MindElec/examples/data_driven/pointcloud/generate_pointcloud/README_CN.md @@ -11,7 +11,7 @@ # 点云数据生成 -为了将电磁仿真的模型转换成神经网络可以识别的模式,我们提供点云生成工具将模型转换成点云数据。该流程分为导出几何/材料信息和点云生成两步: +为了将电磁仿真的模型转换成神经网络可以识别的模式,我们提供将模型转换成点云数据的点云生成工具。该工具的使用分为导出几何/材料信息和点云生成两步: ## 导出几何/材料信息 @@ -33,9 +33,9 @@ MindElec框架提供将stp文件高效转化为点云张量数据的接口`Point - 硬件(Ascend) - 准备Ascend处理器搭建硬件环境。 - 框架 - - [MindELec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) + - [MindElec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) - 如需查看详情,请参见如下资源: - - [MindELec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) + - [MindElec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) - [MindElec Python API](https://www.mindspore.cn/mindscience/api/zh-CN/master/mindelec.html) # 脚本说明 @@ -53,7 +53,7 @@ MindElec框架提供将stp文件高效转化为点云张量数据的接口`Point ## python导出json文件和stp文件 -```python +```shell python export_stp.py --cst_path CST_PATH --stp_path STP_PATH --json_path JSON_PATH @@ -63,7 +63,7 @@ python export_stp.py --cst_path CST_PATH ## 生成点云数据 -```python +```shell python generate_cloud_point.py --stp_path STP_PATH --json_path JSON_PATH --material_dir MATERIAL_DIR @@ -76,4 +76,3 @@ python generate_cloud_point.py --stp_path STP_PATH # MindScience主页 请浏览官网[主页](https://gitee.com/mindspore/mindscience)。 - diff --git a/MindElec/examples/physics_driven/frequency_domain_maxwell/README.md b/MindElec/examples/physics_driven/frequency_domain_maxwell/README.md index 2e46e521834887eeda5ddfbbaf31fabc09fb0c4f..6b42b43e21bd0dbda78a79effb619960fb06f0b7 100644 --- a/MindElec/examples/physics_driven/frequency_domain_maxwell/README.md +++ b/MindElec/examples/physics_driven/frequency_domain_maxwell/README.md @@ -73,7 +73,7 @@ AI uses self-supervised training to solve the Maxwell's equations in frequency d ### Script Parameters -You can set training parameters and sampling parameters in src.config.py. +You can set training parameters and sampling parameters in `src/config.py`. ```python Helmholtz2D_config = ed({ @@ -105,13 +105,13 @@ rectangle_sampling_config = ed({ You can use the solve.py script to train and solve the Maxwell's equations in frequency domain. During the training, the model parameters are automatically saved as a checkpoint file. -```python +```shell python solve.py ``` The loss values are displayed in real time during training: -```python +```log epoch: 1 step: 79, loss is 630.0 epoch time: 26461.205 ms, per step time: 334.952 ms epoch: 2 step: 79, loss is 196.4 diff --git a/MindElec/examples/physics_driven/frequency_domain_maxwell/README_CN.md b/MindElec/examples/physics_driven/frequency_domain_maxwell/README_CN.md index f9631f87d9bcfaf0823bf4a145093091568a1133..e257477d2fb1e565ba97bbb8c026a934c85ae900 100644 --- a/MindElec/examples/physics_driven/frequency_domain_maxwell/README_CN.md +++ b/MindElec/examples/physics_driven/frequency_domain_maxwell/README_CN.md @@ -44,9 +44,9 @@ AI求解频域麦克斯韦方程时使用自监督方式训练,数据集在运 - 硬件(Ascend) - 准备Ascend处理器搭建硬件环境。 - 框架 - - [MindELec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) + - [MindElec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) - 如需查看详情,请参见如下资源: - - [MindELec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) + - [MindElec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) - [MindElec Python API](https://www.mindspore.cn/mindscience/api/zh-CN/master/mindelec.html) ## 脚本说明 @@ -68,7 +68,7 @@ AI求解频域麦克斯韦方程时使用自监督方式训练,数据集在运 ### 脚本参数 -在src.config.py里面可以设置训练的参数和采样参数 +在`src/config.py`里面可以设置训练的参数和采样参数 ```python Helmholtz2D_config = ed({ @@ -100,13 +100,13 @@ rectangle_sampling_config = ed({ 您可以通过solve.py脚本训练求解频域麦克斯韦方程,训练过程中模型参数会自动保存为检查点文件: -```python +```shell python solve.py ``` 训练过程中会实时显示损失函数值: -```python +```log epoch: 1 step: 79, loss is 630.0 epoch time: 26461.205 ms, per step time: 334.952 ms epoch: 2 step: 79, loss is 196.4 diff --git a/MindElec/examples/physics_driven/incremental_learning/README.md b/MindElec/examples/physics_driven/incremental_learning/README.md index 95299f39a995bd15fa7fa5d1e942ccf5f1c14527..1ab904674f473488549ac712fc70853aad7d5f19 100644 --- a/MindElec/examples/physics_driven/incremental_learning/README.md +++ b/MindElec/examples/physics_driven/incremental_learning/README.md @@ -6,8 +6,6 @@ - [Maxwell's Equations](#maxwells-equations) - [Solving Point Source Maxwell's Equations with AI](#solving-point-source-maxwells-equations-with-ai) - [Datasets](#datasets) - - [Features](#features) - - [Mixed Precision](#mixed-precision) - [Environmental Requirements](#environmental-requirements) - [Script Description](#script-description) - [Script and Sample Code](#script-and-sample-code) @@ -67,13 +65,6 @@ In the preceding information, $\lambda$s indicates the weight of each loss funct - Evaluation data: We generate high-precision electromagnetic fields based on traditional finite-difference time-domain algorithms. - Note: Data is processed in src/dataset.py. -## Features - -### Mixed Precision - -The [mixed precision](https://www.mindspore.cn/docs/programming_guide/en/master/enable_mixed_precision.html) training strategy uses single-precision and semi-precision data to improve the training speed of deep learning neural networks, while maintaining the network precision that can be achieved by single-precision training. Mixed precision training improves computing speed and reduces memory usage while enabling larger models or larger batches of training on specific hardware. -Take the FP16 operator as an example. If the input data type is FP32, the MindSpore background automatically reduces the precision to process data. You can open the INFO log and search for "reduce precision" to view operators whose precision decreases. - ## Environmental Requirements - Hardware (Ascend) @@ -108,7 +99,7 @@ Take the FP16 operator as an example. If the input data type is FP32, the MindSp ### Script Parameters -The dataset sampling control parameters are set in the src/sampling_config.py file as follows: +The dataset sampling control parameters are set in the `src/sampling_config.py` file as follows: ```python src_sampling_config = edict({ # src sampling configuration @@ -162,7 +153,7 @@ bc_sampling_config = edict({ # boundary condition samlping configuratio }) ``` -The pre-model training and control parameters are configured in the congig/pretrain.json file as follows: +The pre-model training and control parameters are configured in the `config/pretrain.json` file as follows: ```python { @@ -210,7 +201,7 @@ The pre-model training and control parameters are configured in the congig/pretr } ``` -The incremental training fine-tuning and control parameters are configured in the congig/pretrain.json file as follows: +The incremental training fine-tuning and control parameters are configured in the `config/pretrain.json` file as follows: ```python { @@ -269,7 +260,7 @@ In this tutorial, the network architecture of multi-channel residual network com You can use the piad.py script to train a parametric electromagnetic simulation model. During the training, the model parameters are automatically saved. -```python +```shell python piad.py --mode=pretrain ``` @@ -277,7 +268,7 @@ python piad.py --mode=pretrain The script provides the function of evaluation while training. The loss function, performance data, and precision evaluation result of network training are as follows: -```python +``` log epoch: 1 step: 28, loss is 4.332097 epoch time: 198849.624 ms, per step time: 7101.772 ms epoch: 2 step: 28, loss is 4.150775 @@ -329,13 +320,13 @@ l2_error, Ex: 0.06892983792636541 , Ey: 0.06803824510149464 , Hz: 0.070612441 Given a new set of equation parameters, you can use the piad.py script to load the pre-trained model and fine-tune the test dataset to quickly obtain a solution to the new problem. -```python +```shell python piad.py --mode=reconstruct ``` ## Fine-tuning Performance and Accuracy -```python +```log epoch: 1 step: 32, loss is 3.4485734 epoch time: 207.005 s, per step time: 6468.899 ms epoch: 2 step: 32, loss is 3.2356246 diff --git a/MindElec/examples/physics_driven/incremental_learning/README_CN.md b/MindElec/examples/physics_driven/incremental_learning/README_CN.md index 0337fa4507e4c62bdd82d61fb612c51cba3b624a..25b64e723f8b4395d7c64f703ffd160c680f5f5e 100644 --- a/MindElec/examples/physics_driven/incremental_learning/README_CN.md +++ b/MindElec/examples/physics_driven/incremental_learning/README_CN.md @@ -4,8 +4,6 @@ - [麦克斯韦方程组](#麦克斯韦方程组) - [AI求解点源麦克斯韦方程族](#ai求解点源麦克斯韦方程族) - [数据集](#数据集) - - [特性](#特性) - - [混合精度](#混合精度) - [环境要求](#环境要求) - [脚本说明](#脚本说明) - [脚本及样例代码](#脚本及样例代码) @@ -20,7 +18,7 @@ ## 麦克斯韦方程组 -麦克斯韦方程组一组描述电场、磁场与电荷密度、电流密度之间关系的偏微分方程,有激励源的控制方程具体描述如下: +麦克斯韦方程组是一组描述电场、磁场与电荷密度、电流密度之间关系的偏微分方程,有激励源的控制方程具体描述如下: $$ \nabla\times E=-\mu \dfrac{\partial H}{\partial t}, @@ -29,7 +27,7 @@ $$ \nabla\times H=\epsilon \dfrac{\partial E}{\partial t} + J(x, t) $$ -其中$\epsilon,\mu$分别是介质的绝对介电常数、绝对磁导率。$J(x, t)$是电磁仿真过程中的激励源,常用的加源方式包括点源,线源和面源,本案例主要考虑点源的形式,数学上表示为: +其中$\epsilon,\mu$分别是介质的绝对介电常数、绝对磁导率。$J(x, t)$是电磁仿真过程中的激励源,常用的加源方式包括点源,线源和面源,本案例主要考虑点源的形式,其数学表示为: $$ J(x, t)=\delta(x - x_0)g(t) $$ @@ -54,22 +52,14 @@ $$L_{total} = \lambda_{src}L_{src} + \lambda_{src_ic}L_{src_ic} + \lambda_{no_sr - 评估数据:我们基于传统的时域有限差分算法生成高精度的电磁场。 - 注:数据在src/dataset.py中处理。 -## 特性 - -### 混合精度 - -采用[混合精度](https://www.mindspore.cn/docs/programming_guide/zh-CN/master/enable_mixed_precision.html)的训练方法使用支持单精度和半精度数据来提高深度学习神经网络的训练速度,同时保持单精度训练所能达到的网络精度。混合精度训练提高计算速度、减少内存使用的同时,支持在特定硬件上训练更大的模型或实现更大批次的训练。 - -以FP16算子为例,如果输入数据类型为FP32,MindSpore后台会自动降低精度来处理数据。用户可打开INFO日志,搜索“reduce precision”查看精度降低的算子。 - ## 环境要求 - 硬件(Ascend) - 准备Ascend处理器搭建硬件环境。 - 框架 - - [MindELec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) + - [MindElec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) - 如需查看详情,请参见如下资源: - - [MindELec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) + - [MindElec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) - [MindElec Python API](https://www.mindspore.cn/mindscience/api/zh-CN/master/mindelec.html) ## 脚本说明 @@ -96,7 +86,7 @@ $$L_{total} = \lambda_{src}L_{src} + \lambda_{src_ic}L_{src_ic} + \lambda_{no_sr ### 脚本参数 -数据集采样控制参数在src/sampling_config.py文件中配置如下: +数据集采样控制参数在`src/sampling_config.py`文件中配置: ```python src_sampling_config = edict({ # 有源区域的采样配置 @@ -150,7 +140,7 @@ bc_sampling_config = edict({ # 边界区域的采样配置 }) ``` -预模型训练及控制参数在congig/pretrain.json文件中配置如下: +预模型训练及控制参数在`config/pretrain.json`文件中配置: ```python { @@ -198,7 +188,7 @@ bc_sampling_config = edict({ # 边界区域的采样配置 } ``` -增量训练微调及控制参数在congig/pretrain.json文件中配置如下: +增量训练微调及控制参数在`config/pretrain.json`文件中配置如下: ```python { @@ -257,7 +247,7 @@ bc_sampling_config = edict({ # 边界区域的采样配置 您可以通过piad.py脚本训练参数化电磁仿真模型,训练过程中模型参数会自动保存: -```python +```shell python piad.py --mode=pretrain ``` @@ -265,7 +255,7 @@ python piad.py --mode=pretrain 脚本提供了边训练边评估的功能,网络训练的损失函数、性能数据以及精度评估结果如下: -```python +```log epoch: 1 step: 28, loss is 4.332097 epoch time: 198849.624 ms, per step time: 7101.772 ms epoch: 2 step: 28, loss is 4.150775 @@ -317,13 +307,13 @@ l2_error, Ex: 0.06892983792636541 , Ey: 0.06803824510149464 , Hz: 0.070612441 给定一组新的方程参数,您可以通过piad.py脚本加载预训练模型与测试数据集增量训练,从而快速得到新问题的解: -```python +```shell python piad.py --mode=reconstruct ``` ## 增量训练性能与精度 -```python +``` log epoch: 1 step: 32, loss is 3.4485734 epoch time: 207.005 s, per step time: 6468.899 ms epoch: 2 step: 32, loss is 3.2356246 diff --git a/MindElec/examples/physics_driven/time_domain_maxwell/README.md b/MindElec/examples/physics_driven/time_domain_maxwell/README.md index 1e3a56e6727579ccb8dcb74c96084fac537582f8..6243a6165db8c37749101d58708d1abdd04e2331 100644 --- a/MindElec/examples/physics_driven/time_domain_maxwell/README.md +++ b/MindElec/examples/physics_driven/time_domain_maxwell/README.md @@ -4,8 +4,6 @@ - [Maxwell's Equations](#maxwells-equations) - [AI Solver of Maxwell's Equations with Point Source](#ai-solver-of-maxwells-equations-with-point-source) - [Datasets](#datasets) -- [Features](#features) - - [Mixed Precision](#mixed-precision) - [Environment Requirements](#environment-requirements) - [Script Description](#script-description) - [Script and Sample Code](#script-and-sample-code) @@ -50,13 +48,6 @@ where $\lambda$s indicates the weight of each loss function. In order to reduce - Evaluation data: We generate high-precision electromagnetic fields based on traditional finite-difference time-domain algorithms. - Note: Data is processed in src/dataset.py. -# Features - -## Mixed Precision - -The [mixed precision](https://www.mindspore.cn/docs/programming_guide/en/master/enable_mixed_precision.html) training strategy uses single-precision and semi-precision data to improve the training speed of deep learning neural networks, while maintaining the network precision that can be achieved by single-precision training. Mixed precision training improves computing speed and reduces memory usage while enabling larger models or larger batches of training on specific hardware. -Take the FP16 operator as an example. If the input data type is FP32, the MindSpore background automatically reduces the precision to process data. You can open the INFO log and search for "reduce precision" to view operators whose precision decreases. - # Environment Requirements - Hardware (Ascend) @@ -90,7 +81,7 @@ Take the FP16 operator as an example. If the input data type is FP32, the MindSp ## Script Parameters -The dataset sampling control parameters are set in the src/sampling_config.py file as follows: +The dataset sampling control parameters are set in the `src/sampling_config.py` file as follows: ```python src_sampling_config = edict({ # sampling configuration of the near-source region @@ -144,7 +135,7 @@ bc_sampling_config = edict({ # sampling configuration of boundary point }) ``` -Training parameters are configured in config.json as follows: +Training parameters are configured in `config.json` as follows: ```python { @@ -196,7 +187,7 @@ In this tutorial, the network architecture of multi-channel residual network com You can start training by running train.py as follows. The model parameters are automatically saved during training. -```python +```shell python train.py ``` @@ -204,7 +195,7 @@ python train.py The script provides the function of evaluation while training. The total loss, performance data, and precision evaluation result of network training are as follows: -```python +```log epoch: 1 step: 8, loss is 11.496931 epoch time: 185.432 s, per step time: 23178.955 ms epoch: 2 step: 8, loss is 9.000967 @@ -261,13 +252,13 @@ MindInsight also provides the ability to visualize accuracy curves in real time. After training, you can start evaluation by running eval.py as follows: -```python +```shell python eval.py ``` ## Evaluation Performance and Accuracy -```python +```log predict total time: 40.59165406227112 s l2_error, Ex: 0.03556711707787814 , Ey: 0.03434167989333677 , Hz: 0.022974221345851673 ``` diff --git a/MindElec/examples/physics_driven/time_domain_maxwell/README_CN.md b/MindElec/examples/physics_driven/time_domain_maxwell/README_CN.md index 3ea4d332a1c3a17114fb892188babd39a498b741..8e3952eda5fe6688ec3545319d829c04a2cc1b9b 100644 --- a/MindElec/examples/physics_driven/time_domain_maxwell/README_CN.md +++ b/MindElec/examples/physics_driven/time_domain_maxwell/README_CN.md @@ -4,8 +4,6 @@ - [麦克斯韦方程组](#麦克斯韦方程组) - [AI求解点源麦克斯韦方程组](#ai求解点源麦克斯韦方程组) - [数据集](#数据集) -- [特性](#特性) - - [混合精度](#混合精度) - [环境要求](#环境要求) - [脚本说明](#脚本说明) - [脚本及样例代码](#脚本及样例代码) @@ -20,7 +18,7 @@ # 麦克斯韦方程组 -麦克斯韦方程组一组描述电场、磁场与电荷密度、电流密度之间关系的偏微分方程,有激励源的控制方程具体描述如下: +麦克斯韦方程组是一组描述电场、磁场与电荷密度、电流密度之间关系的偏微分方程,有激励源的控制方程具体描述如下: $$ \nabla\times E=-\mu \dfrac{\partial H}{\partial t}, @@ -50,22 +48,14 @@ $$L_{total} = \lambda_{src}L_{src} + \lambda_{src_ic}L_{src_ic} + \lambda_{no_sr - 评估数据:我们基于传统的时域有限差分算法生成高精度的电磁场。 - 注:数据在src/dataset.py中处理。 -# 特性 - -## 混合精度 - -采用[混合精度](https://www.mindspore.cn/docs/programming_guide/zh-CN/master/enable_mixed_precision.html)的训练方法使用支持单精度和半精度数据来提高深度学习神经网络的训练速度,同时保持单精度训练所能达到的网络精度。混合精度训练提高计算速度、减少内存使用的同时,支持在特定硬件上训练更大的模型或实现更大批次的训练。 - -以FP16算子为例,如果输入数据类型为FP32,MindSpore后台会自动降低精度来处理数据。用户可打开INFO日志,搜索“reduce precision”查看精度降低的算子。 - # 环境要求 - 硬件(Ascend) - 准备Ascend处理器搭建硬件环境。 - 框架 - - [MindELec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) + - [MindElec](https://gitee.com/mindspore/mindscience/tree/master/MindElec) - 如需查看详情,请参见如下资源: - - [MindELec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) + - [MindElec教程](https://www.mindspore.cn/mindscience/docs/zh-CN/master/mindelec/intro_and_install.html) - [MindElec Python API](https://www.mindspore.cn/mindscience/api/zh-CN/master/mindelec.html) # 脚本说明 @@ -91,7 +81,7 @@ $$L_{total} = \lambda_{src}L_{src} + \lambda_{src_ic}L_{src_ic} + \lambda_{no_sr ## 脚本参数 -数据集采样控制参数在src/sampling_config.py文件中配置如下: +数据集采样控制参数在`src/sampling_config.py`文件中配置如下: ```python src_sampling_config = edict({ # 有源区域的采样配置 @@ -145,7 +135,7 @@ bc_sampling_config = edict({ # 边界区域的采样配置 }) ``` -模型训练及控制参数在config.json文件中配置如下: +模型训练及控制参数在`config.json`文件中配置如下: ```python { @@ -197,7 +187,7 @@ bc_sampling_config = edict({ # 边界区域的采样配置 您可以通过train.py脚本训练参数化电磁仿真模型,训练过程中模型参数会自动保存: -```python +```shell python train.py ``` @@ -205,7 +195,7 @@ python train.py 脚本提供了边训练边评估的功能,网络训练的损失函数、性能数据以及精度评估结果如下: -```python +```log epoch: 1 step: 8, loss is 11.496931 epoch time: 185.432 s, per step time: 23178.955 ms epoch: 2 step: 8, loss is 9.000967 @@ -262,13 +252,13 @@ Mindinsight同样提供了实时可视化精度曲线的功能。在网页打开 您可以通过eval.py脚本加载测试数据集进行推理,并获取推理精度: -```python +```shell python eval.py ``` ## 推理性能与精度 -```python +```log predict total time: 40.59165406227112 s l2_error, Ex: 0.03556711707787814 , Ey: 0.03434167989333677 , Hz: 0.022974221345851673 ```