This is the code and data for GANTL: Toward Practical and Real-Time Topology Optimization With Conditional Generative Adversarial Networks and Transfer Learning paper published in the Journal of Mechanical Design.
- Tensorflow == 2.3.0
- H5Py == 2.10.0
- Matplotlib == 3.5.1
- Numpy == 1.21.6
--res: The resolution of the domain.- Options:
4080(default),80160,120160,120240,160320,200400
- Options:
--traintest:- Options:
traintestwhich train the model and test that- Note: You have to train on 4080 before you try to train on other resolutions.
testwhich test the saved model
- Options:
--batch_size: The batch size for the model training (default = 16)--n_epoch: The number of epochs for training (default = 500)--save_step: Save models every x epoch (default = 50)--lr: Learning rate (default = 2e-4)--TOloss: Whether to test the TO model or not (default = False)- Note 1: it should be used only on the test mode
- Note 2: the resolution must be 200400
The data can be downloaded from this link. You have to extract that to the data folder ( it would be like data/'res') . To download the pretrained models, you can use this link. You have to extract the models under GANTL folder (it would be like GANTL/'res').
To train a model you can use the following command:
python main.py --res 4080 --traintest traintestThe code will train the model and save the models in GANTL/'res'/model folder. It also save the images obtained during the training in GANTL/'res'/images. The final predictions will be saved in GANTL/'res'/prediction.
To test the model, one can run the following command:
python main.py --res 4080 --traintest testThe result will be saved in GANTL/'res'/prediction.
Note: You can run these codes for any resolutions.
To test the model on TO loss, you have to run the following command:
python main.py --res 200400 --traintest test --TOloss True@article{behzadi2022gantl,
title={GANTL: Toward Practical and Real-Time Topology Optimization With Conditional Generative Adversarial Networks and Transfer Learning},
author={Behzadi, Mohammad Mahdi and Ilie{\c{s}}, Horea T},
journal={Journal of Mechanical Design},
volume={144},
number={2},
year={2022},
publisher={American Society of Mechanical Engineers Digital Collection}
}