该项目是《Problem-independent machine learning (PIML)-based topology optimization—A universal approach》的python复现
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1.6 KiB

该项目是《Problem-independent machine learning (PIML)-based topology optimization—A universal approach》的python复现

环境依赖

PyTorch 2.1.0 CUDA 12.1 Ubuntu 20.04 (没有用到新特性,所以应该对旧版本兼容)

# matplotlib==3.8.0
# numpy==1.26.2
# scikit_learn==1.3.0
# torch==2.1.0
pip install -r requirements.txt

Usage

TODO: [done] 用argparse模块管理网络参数

Train

python train.py
# --mod [mod1 mod2 mod3] 参数选择训练数据,默认mod1
# e.g. python train.py --mod mod1

Test

python test.py
# --mod [mod1 mod2 mod3] 参数选择测试数据,默认mod3
# --pretrained_model_path <xxx_opt.pt> 选择预训练模型,默认./checkpoints/ANN_mod1/ANN_mod1_opt.pt
# e.g. python test.py --mod mod3 --pretrained_model_path ./checkpoints/ANN_mod1/ANN_mod1_opt.pt

TopOpt with EMsFEA net

python topopt_EMsFEA.py

数据集

通过经典二维拓扑优化代码生成的三组形变、密度数据

mod1:

mod2:

mod3:

项目结构

.
|-- README.md
|-- checkpoints
|   `-- ...
|-- datasets
|   |-- train
|   |   `--resolution
|   |      |--u
|   |      `--xPhys
|   |-- test
|-- models
|   |-- ANN.py
|   |-- AutoEncoder.py
|   |-- CNN.py
|   `-- __init__.py
|-- options
|   |-- __init__.py
|   |-- base_options.py
|   |-- test_options.py
|   `-- train_options.py
|-- requirements.txt
|-- results
|-- test.py
|-- topopt_EMsFEA.py
|-- train.py
|-- utils
|   |-- data_loader.py
|   |-- data_standardizer.py
|   |-- topopt_88.py
|   `-- utils.py
`-- visualization.ipynb