This is a project of Multiphase flow & Flow visualization Lab. The purpose of the project is to obtain the bubble velocity field from experimental images using CNN-based optical flow model. More information can be found in the paper (Choi et al. 2022).
The codes are based on PWC_Net (Sun et al. 2018) with the pre-trained weights. The tensorflow version can be found here.
The output of the model is as follows:
- velocity field (two dimensional array in techplot format, or it can be read through wordpad or text in Window OS)
- velocity field contour (png)
The repository includes:
- Source code of implementation of PWC-Net based on the finetuned weights.
- Source code to generate the velocity field (techplot file) and its contour (png).
The examples of the result is shown below:
-
Comparison with the PTV and CNN-based optical flow for dense bubble plume
-
Effect of the training (it is seen that the horizontal vectors from the weakly trained model are inaccurate)
This code was tested on the below environment.
- NVIDIA RTX 2080 ti
- Driver 440.95.01
- CUDA 10.2
- cuDNN 7.6.5
- Python 3.7
- TensorFlow 1.14.0
- Keras 2.2.5 (If compatibility issue occurs, please refer to the original PWC-Net link)
Prepare two consecutive bubble images (format of JPG or PNG or TIF) and one mask image.
- For example, Img_0001.png, Img_0002.png, and msk_0001.png
- (Here, the square size is recommended, e.g., 300 x 300 pixels)
-
Clone this repository
-
Install dependencies (If compatibility issue occurs, please refer to the original PWC-Net link)
-
Download trained weights from this link.
-
Run prediction script (CNN_OpticalFlow.ipynb) in
Code/
directory to obtain the velocity field (supports only 3-channel jpg image).
- Code is attached in the "SyntheticBubbleImage" folder.
- The density, velocity, magnitude of deformation (or the light noise) can be controlled using code.
- Output of the code is as follows: Two consecutive bubble images and one flow file (visualized by color contour below).
Any comments/questions are welcome. Please contact to [email protected]