StrainNet estimates subpixelic displacement and strain fields from pairs of reference and deformed images of a flat speckled surface, as Digital Image Correlation (DIC) does. See paper [1] for details.
If you find this implementation useful, please cite reference [1]. Also, make sure to adhere to the licensing terms of the authors.
Install the following modules:
pytorch >= 1.2
torchvision
tensorboardX
imageio
argparse
path.py
numpy
pandas
tqdm
- Generate Speckle dataset 1.0 or 2.0
- Specify the paths to: Train dataset, Test dataset, Train_annotations.csv, and Test_annotations.csv in the file Train.py (exactly in the definition of train_set and test_set)
- Execute the following commands
python Train.py --arch StrainNet_h
python Train.py --arch StrainNet_f
The images pairs should be in the same location, with the name pattern *1.ext *2.ext
python inference.py /path/to/input/images/ --arch StrainNet_h --pretrained /path/to/pretrained/model
python inference.py /path/to/input/images/ --arch StrainNet_f --pretrained /path/to/pretrained/model
The pretrained models of StrainNet-h and StrainNet_f are available here
Execute the following commands in the StrainNet directory (please also copy here the tar files if you use the pretrained models)
python inference.py ../Star_frames/Noiseless_frames/ --arch StrainNet_h --pretrained StrainNet-h.pth.tar
python inference.py ../Star_frames/Noiseless_frames/ --arch StrainNet_f --pretrained StrainNet-f.pth.tar
The output of inference.py can be found in Star_frames/Noiseless_frames/flow/
You can use Script_flow.m to visualize the obtained displacements
Reference image | |
---|---|
Reference displacement | |
Retrieved by StrainNet-h | |
Retrieved by StrainNet-f |
[1] S. Boukhtache, K. Abdelouahab, F. Berry, B. Blaysat, M. Grédiac and F. Sur. "When Deep Learning Meets Digital Image Correlation", Optics and Lasers in Engineering, Elsevier 2020, in press.
This code is based on the Pytorch implmentation of FlowNetS from FlowNetPytorch