## UA DataLab Projects Development ### Project: Image Segmentation in Material Sciences #### Description This project aims to utilize Meta's [Segment Anything Model](https://segment-anything.com) (SAM) to automatically detect, classify, and catalogue grain information from micrograph image data collected by materials scientists. Here's an example of a Scanning Electron Microscope (SEM) micrograph taken at the Kuiper Imaging Facility at UArizona: ![](https://hackmd.io/_uploads/ByOn5CS-6.png) [Segmenteverygrain](https://github.com/zsylvester/segmenteverygrain) is a SAM-based model for performing image segmentation of grains that relies on a CNN to create a first-pass segmentation for subsequent SAM segmentation. However, most images will still require some sort of pre-processing, such as contrast enhancement. Here's that same SEM micrograph with overlaid SAM masks generated from segmenteverygrain: ![](https://hackmd.io/_uploads/ByaJT0BZT.jpg) While most grains are correctly identified, there are masks that cover multiple grains, skewing the population statistics. There are also examples of small masks that are misclassified. This project will aim to complete the following goals: #### Project Goals 1) Implement a method to extract scale information directly from images or image metadata. 2) Implement an automated image pre-processing scheme to facilitate superior image segmentation with segmenteverygrain. 3) Adapt this workflow to automatically segment a directory/subdirectories of images. 4) Generate segmented image statistics for each image and store them inside a pandas dataframe. Present the user with a summary and flag potential outliers. ## Manual Tasks per Image ([FIJI](https://fiji.sc/)) | Task # | Task Name | Task Time| | :--------: | ------- | :-------: | | 1 | Image Preprocessing | < 5 Minutes | | 2 | Scale Metadata Extraction | ~ 1 Minute | | 3 | Manual Grain Diameter Calculation | 5s / Grain | | 4 | Manual Grain Area Calculation | 10s / Grain | | 5 | Calculate Statistics | ~ 1 Minute | | 6 | Export .csv to Visualization Tool | ~ 1 Minute | | 7 | Plot Histograms and Overlay Gaussian | ~ 5 Minutes | ## Automation Tasks