Thermal Control of Laser Powder Bed Fusion using Deep Reinforcement Learning

Overview

Thermal Control of Laser Powder Bed Fusion using Deep Reinforcement Learning

This repository is the implementation of the paper "Thermal Control of Laser Powder Bed Fusion Using Deep Reinforcement Learning", linked here. The project makes use of the Deep Reinforcement Library stable-baselines3 to derive a control policy that maximizes melt pool depth consistency. drl_am

Simulation Framework

The Repeated Usage of Stored Line Solutions (RUSLS) method proposed by Wolfer et al. is used to simulate the temperature dynamics in this work. More detail can be found in the following paper:

  • Fast solution strategy for transient heat conduction for arbitrary scan paths in additive manufacturing, Additive Manufacturing, Volume 30, 2019 (link)

Prerequisites

The following packages are required in order to run the associated code:

  • gym==0.17.3
  • torch==1.5.0
  • stable_baselines3==0.7.0
  • numba==0.50.1

These packages can be installed independently, or all at once by running pip install -r requirements.txt. We recommend that these packages are installed in a new conda environment to avoid clashes with existing package installations. Instructions on defining a new conda environment can be found here.

Usage

The overall workflow for this project first defines a gym environment based on the desired scan path, then performs Proximal Policy Optimization to derive a suitable control policy based on the environment. This is done through the following:

Overview

  • EagarTsaiModel.py: implements the RUSLS solution to the Rosenthal equation, as proposed by Wolfer et al.
  • power_square_gym.py, power_triangle_gym.py, velocity_square_gym.py, velocity_triangle_gym.py: Defines custom gym environments for the respective scan paths and control variables. square is used as shorthand for the predefined horizontal cross-hatching path and triangle is used as shorthand for the predefined concentric triangular path.
  • RL_learn_square.py, RL_learn_triangle.py performs Proximal Policy Optimization on the respective scan paths, with command line arguments to change which control parameter is varied.
  • evaluate_learned_policy.py runs a derived control policy on a specific environment. The environment is specified using command line arguments detailed below.

Testing a trained model

To test a trained model on a specific combination of scan path and control parameter, enter this command:

python evaluate_learned_policy.py --path [scan_path] --param [parameter]

Note: [scan_path] should be replaced by square for the horizontal cross-hatching scan path and triangle for the concentric triangular path. [parameter] should be replaced by power to specify power as a control parameter, and velocity to specify velocity as a control parameter.

Upon running this command, you will be prompted to enter the path to the .zip file for the trained model.

Once the evaluation is complete, the results are stored in the folder results/[scan_path]_[parameter]_control/. This folder will contain plots of the variation of the melt depth and control parameters over time, as well as their raw values for later analysis.

Pre-trained models for each of the four possible combinations of scan path and control parameter can be found in pretrained_models.

Training a new model

In order to train a new model based on the predefined horizontal cross-hatching scan path, enter the command:

python RL_learn_square.py --param [parameter]

Here, [parameter] should be replaced by the control parameter desired. The possible options are power and velocity.

The process is similar for the predefined concentric triangular scan path. To train a new model, enter the command:

python RL_learn_triangle.py --param [parameter]

Again, [parameter] should be replaced by the control parameter desired. The possible options are power and velocity.

During training, intermediate model checkpoints will be saved at

training_checkpoints/ppo_[scan_path]_[parameter]/best_model.zip

At the conclusion of training, the finished model is stored at

trained_models/ppo_[scan_path]_[parameter].zip

Defining a custom domain

Changing the powder bed features

In order to define a custom domain for use with a different problem configuration, the EagarTsaiModel.py file should be edited directly. Within the EagarTsai() class instantiation, the thermodynamic properties and domain dimensions can be specified. Additionally, the resolution and boundary conditions can be provided as arguments to the EagarTsai class. bc = 'flux' and bc = 'temp' implements an adiabatic and constant temperature boundary condition respectively.

Changing the scan path

A new scan path can be defined by creating a new custom gym environment, and writing a custom step() function to represent the desired scan path, similar to the [parameter]_[scan_path]_gym.py scripts in this repository. Considerations for both how the laser moves during a single segment and the placement of each segment within the overall path should be described in this function. More detail on the gym framework for defining custom environments can be found here.

Monitoring the training process with TensorBoard

Tensorboard provides resources for monitoring various metrics of the PPO training process, and can be installed using pip install tensorboard. To open the tensorboard dashboard, enter the command:

tensorboard --log_dir ./tensorboard_logs/ppo_[scan_path]_[parameter]/ppo_[scan_path]_[parameter]_[run_ID]

Tensorboard log files are periodically saved during training, with information on cumulative reward as well as various loss metrics.

Owner
BaratiLab
BaratiLab
[ICLR 2021] Heteroskedastic and Imbalanced Deep Learning with Adaptive Regularization

Heteroskedastic and Imbalanced Deep Learning with Adaptive Regularization Kaidi Cao, Yining Chen, Junwei Lu, Nikos Arechiga, Adrien Gaidon, Tengyu Ma

Kaidi Cao 29 Oct 20, 2022
unofficial pytorch implementation of RefineGAN

RefineGAN unofficial pytorch implementation of RefineGAN (https://arxiv.org/abs/1709.00753) for CSMRI reconstruction, the official code using tensorpa

xinby17 5 Jul 21, 2022
RoMA: Robust Model Adaptation for Offline Model-based Optimization

RoMA: Robust Model Adaptation for Offline Model-based Optimization Implementation of RoMA: Robust Model Adaptation for Offline Model-based Optimizatio

9 Oct 31, 2022
Get the partition that a file belongs and the percentage of space that consumes

tinos_eisai_sy Get the partition that a file belongs and the percentage of space that consumes (works only with OSes that use the df command) tinos_ei

Konstantinos Patronas 6 Jan 24, 2022
Cascaded Pyramid Network (CPN) based on Keras (Tensorflow backend)

ML2 Takehome Project Reimplementing the paper: Cascaded Pyramid Network for Multi-Person Pose Estimation Dataset The model uses the COCO dataset which

Vo Van Tu 1 Nov 22, 2021
QICK: Quantum Instrumentation Control Kit

QICK: Quantum Instrumentation Control Kit The QICK is a kit of firmware and software to use the Xilinx RFSoC to control quantum systems. It consists o

81 Dec 15, 2022
GalaXC: Graph Neural Networks with Labelwise Attention for Extreme Classification

GalaXC GalaXC: Graph Neural Networks with Labelwise Attention for Extreme Classification @InProceedings{Saini21, author = {Saini, D. and Jain,

Extreme Classification 28 Dec 05, 2022
Task Transformer Network for Joint MRI Reconstruction and Super-Resolution (MICCAI 2021)

T2Net Task Transformer Network for Joint MRI Reconstruction and Super-Resolution (MICCAI 2021) [Paper][Code] Dependencies numpy==1.18.5 scikit_image==

64 Nov 23, 2022
DGCNN - Dynamic Graph CNN for Learning on Point Clouds

DGCNN is the author's re-implementation of Dynamic Graph CNN, which achieves state-of-the-art performance on point-cloud-related high-level tasks including category classification, semantic segmentat

Wang, Yue 1.3k Dec 26, 2022
Regularizing Generative Adversarial Networks under Limited Data (CVPR 2021)

Regularizing Generative Adversarial Networks under Limited Data [Project Page][Paper] Implementation for our GAN regularization method. The proposed r

Google 148 Nov 18, 2022
The codes for the work "Swin-Unet: Unet-like Pure Transformer for Medical Image Segmentation"

Swin-Unet The codes for the work "Swin-Unet: Unet-like Pure Transformer for Medical Image Segmentation"(https://arxiv.org/abs/2105.05537). A validatio

869 Jan 07, 2023
EMNLP 2021 Findings' paper, SCICAP: Generating Captions for Scientific Figures

SCICAP: Scientific Figures Dataset This is the Github repo of the EMNLP 2021 Findings' paper, SCICAP: Generating Captions for Scientific Figures (Hsu

Edward 26 Nov 21, 2022
Skyformer: Remodel Self-Attention with Gaussian Kernel and Nystr\"om Method (NeurIPS 2021)

Skyformer This repository is the official implementation of Skyformer: Remodel Self-Attention with Gaussian Kernel and Nystr"om Method (NeurIPS 2021).

Qi Zeng 46 Sep 20, 2022
TrTr: Visual Tracking with Transformer

TrTr: Visual Tracking with Transformer We propose a novel tracker network based on a powerful attention mechanism called Transformer encoder-decoder a

趙 漠居(Zhao, Moju) 66 Dec 27, 2022
Official PyTorch Implementation of paper EAN: Event Adaptive Network for Efficient Action Recognition

Official PyTorch Implementation of paper EAN: Event Adaptive Network for Efficient Action Recognition

TianYuan 27 Nov 07, 2022
A web-based application for quick, scalable, and automated hyperparameter tuning and stacked ensembling in Python.

Xcessiv Xcessiv is a tool to help you create the biggest, craziest, and most excessive stacked ensembles you can think of. Stacked ensembles are simpl

Reiichiro Nakano 1.3k Nov 17, 2022
Implementation of the paper ''Implicit Feature Refinement for Instance Segmentation''.

Implicit Feature Refinement for Instance Segmentation This repository is an official implementation of the ACM Multimedia 2021 paper Implicit Feature

Lufan Ma 17 Dec 28, 2022
Simple API for UCI Machine Learning Dataset Repository (search, download, analyze)

A simple API for working with University of California, Irvine (UCI) Machine Learning (ML) repository Table of Contents Introduction About Page of the

Tirthajyoti Sarkar 223 Dec 05, 2022
Supplementary materials to "Spin-optomechanical quantum interface enabled by an ultrasmall mechanical and optical mode volume cavity" by H. Raniwala, S. Krastanov, M. Eichenfield, and D. R. Englund, 2022

Supplementary materials to "Spin-optomechanical quantum interface enabled by an ultrasmall mechanical and optical mode volume cavity" by H. Raniwala,

Stefan Krastanov 1 Jan 17, 2022
Advanced Deep Learning with TensorFlow 2 and Keras (Updated for 2nd Edition)

Advanced Deep Learning with TensorFlow 2 and Keras (Updated for 2nd Edition)

Packt 1.5k Jan 03, 2023