Skip to content

Prediction of microstructural representativity from a single image

License

Notifications You must be signed in to change notification settings

tldr-group/ImageRep

Repository files navigation

ImageRep

Try it out!

Here we introduce the 'ImageRep' method for fast phase fraction representativity estimation from a single microstructural image. This is achieved by calculating the Two-Point Correlation (TPC) function of the image, combined with a data-driven analysis of the MicroLib dataset. By applying a statistical framework that utilizes both data sources, we can establish the uncertainty in the phase fraction in the image with a given confidence, and the image size that would be needed to meet a given target uncertainty. Further details are provided in our paper.

If you use this ImageRep in your research, please cite us.

Usage:

This method can be used via the website (imagerep.io) or as python package - see example.ipynb.

NB: the website may run out of memory for large volumes (>1000x1000x1000) - if this happens run the method locally or contact us

Limitations:

  • This is not the only source of uncertainty! Other sources i.e, segmentation uncertainty, also contribute and may be larger
  • For multi-phase materials, this method estimates the uncertainty in phase-fraction of a single (chosen) phase, counting all the others as a single phase (i.e, a binary microstructure)
  • Not validated for for images smaller than 200x200 or 200x200x200
  • Not validated for large integral ranges/features sizes (>70 px)
  • Not designed for periodic structures
  • 'Length needed for target uncertainty' is an intentionally conservative estimate - retry when you have measured the larger sample to see a more accurate estimate of that uncertainty

Local Installation Instructions

These instructions are for installing and running the method locally. They assume a UNIX enviroment (mac or linux), but adapting for Windows is straightforward. Note you will need 2 terminals, one for the frontend local server and one for the backend local server.

Preliminaries

Install npm (ideally via a manager like nvm) if you want to run the website. Clone this repo and change directory:

git clone https://github.com/tldr-group/Representativity && cd Representativity

Install & run the backend

  1. Setup a virtual environment in Python and activate it (not necessary but recommended)
  2. Install the repo as a local package:
pip install -e .

NOTE: this is all you need to do if you wish to use the method via the python package. To run the website locally, follow the rest of the instructions.

  1. With your virtual environment activated, and inside the representativity/ directory, run
python -m flask --app server run

The server should now be running on http://127.0.0.1:500 and listening for requests!

  1. If you want to reproduce (all) the figures, you'll need pytorch and some additional dependencies. It may be worth using conda to install pytorch as this will interact correctly with your GPU. Run
pip install -r requirements_dev.txt

Install & run the frontend

  1. Install the JS libraries needed to build and run the frontend. Install Yarn (and npm first if needed)
npm install --g yarn
  1. Build and run:
yarn && yarn start
  1. Navigate to http://localhost:8080/ (the browser should do this automatically).

Testing Instructions

Tests

  1. Run (with your virtual enviroment activated!)
python tests/tests.py