This is a Pytorch implementation for unpaired microstructures-to-SEM translation along with downstream tasks (particles segmentation and calcination temperature estimation) to validate generated micrographs.
The desired dataset need to be structured as following
${TRAINING_DATASET_ROOT_FOLDER}
└───images_a
|___train
└───001.jpg
└───002.jpg
└───003.jpg
...
|___val
└───001.jpg
└───002.jpg
└───003.jpg
...
└───images_b
|___train
└───001.jpg
└───002.jpg
└───003.jpg
...
|___val
└───001.jpg
└───002.jpg
└───003.jpg
...
- Execute the script
script/train_i2i.sh
- The following parameters can be modified for desired behaviors:
gpu_id
-- Manually assign a specific gpu for current jobexp_name
-- Name of current experimenttype_exp
-- This parameter should be set toi2i1
for this taskconfig_file
-- Location of config filestage
-- Specify the process [train/val/gen]checkpoint
-- Specify the checkpoint to restorecheckpoint_dir
-- Specify directory of saved checkpointsgen_dir
-- 'Directory for storing generated images
- Execute the script
script/train_seg.sh
orscript/train_clf.sh
- The following parameters can be modified for desired behaviors:
gpu_id
-- Manually assign a specific gpu for current jobexp_name
-- Name of current experimenttype_exp
-- Specify desired downstream task [seg/clf]stage
-- Specify the process [train/test]config_file
-- Location of config filetrain_dir
-- Specify directory of real training datasetval_dir
-- Specify directory of validation datasettest_dir
-- Specify directory of test datasetgen_dir
-- Specify directory of generated images used for trainingsaved_model_dir
-- Specify directory of trained model
This material was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus product, software, or process disclosed, or represents that its use would not infringe privately owned rights.
Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.
PACIFIC NORTHWEST NATIONAL LABORATORY
operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830.
If you find this code useful for your research, please cite our paper:
@inproceedings{ly2025struct2im,
title={Improving microstructures segmentation via pretraining with synthetic data},
author={Ly, Cuong and Frazier, William and Olsen, Adam and Schwerdt, Ian and McDonald, Luther and Hagen, Alex},
journal={Computational Materials Science},
year={2025}
}