Giter Club home page Giter Club logo

shanto268 / quantumdevicesem Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 5.0 433 KB

This program is designed to analyze Scanning Electron Microscope (SEM) images, specifically images of superconducting quantum devices. It uses the Segment Anything library from Meta to identify and segment objects in the image.

Python 99.27% Jupyter Notebook 0.73%
edge-detection image image-processing image-segmentation machine-learning nanoimager nanotechnology quantum-computing quantum-hardware sem superconducting-qubits nano-imaging

quantumdevicesem's Introduction

SEM Image Analyzer

This program is designed to analyze Scanning Electron Microscope (SEM) images, specifically images of superconducting quantum devices. It uses the Segment Anything library from Meta to identify and segment objects in the image.

Table of Contents


Program Functionality

`extract_all_features.py`

Features

  • Takes an SEM image as input and generates masks for all objects in the image.
  • Displays each mask with a bounding box and the dimensions of the bounding box in nanometers.
  • Saves each masked image in a directory structure: results/name of input image/mask#_date created.
  • Extracts the scale from the image and converts it to nanometers, regardless of the original unit.

How It Works

The program works in several steps:

  1. Input SEM Image: The user provides an SEM image as input. Here is an example of an input image:

    Original SEM Image

  2. Extract Scale: The program crops the bottom 80 pixels of the image, which contains the scale. It then uses OCR to extract the number and unit of the scale. Here is an example of the extracted scale:

    Scale

  3. Generate Masks: The program uses the Segment Anything library to generate masks for all objects in the image. It then sorts the masks by area and displays each mask with a bounding box. The dimensions of the bounding box are calculated in nanometers based on the extracted scale.

    Here are examples of the masks generated for the main features in the image:

    Mask 1 Mask 2 Mask 3 Mask 4 Mask 5

  4. Save Images: The program saves each masked image in the results/name of input image/ directory. The images are named according to the mask number and the date created.

Usage

  1. Run the program.
  2. When prompted, enter the path to the SEM image you want to analyze.
  3. The program will generate masks for all objects in the image and save the masked images in the results/name of input image/ directory.
`extract_select_features.py`

Features

  • Takes an SEM image as input and generates masks for selected features in the image.
  • Allows user to select points on the image to generate masks for specific features.
  • Displays each mask with a bounding box and the dimensions of the bounding box in nanometers.
  • Saves each masked image in a directory structure: results/name of input image/mask#_date created.
  • Extracts the scale from the image and converts it to nanometers, regardless of the original unit.

How It Works

The program works in several steps:

  1. Load the 'Segment Anything' model: The program loads the model from Meta's Segment Anything library.
  2. Input SEM Image: The user provides an SEM image as input.
  3. Extract Scale: The program extracts the scale bar length from the image.
  4. Select Points: The user selects points on the image.
  5. Generate Masks: The program generates masks to extract the feature.
  6. Save Images: The program saves the masked image.

Usage

  1. Run the program.
  2. When prompted, enter the path to the SEM image you want to analyze.
  3. Enter the pixel scale (default is 370).
  4. Enter the number of inputs.
  5. The program will generate masks for the selected features in the image and save the masked images in the results/name of input image/ directory.

Installation

  1. Install Python 3.7 or later.
  2. Download the checkpoint file from Meta and store them in the weights subdirectory and update the corresponding line in the main file
# Load the model
sam = sam_model_registry["vit_h"](checkpoint="weights/<checkpoint_file_name>")
  1. Clone this repository to your local machine.
  2. Install the required Python libraries. You can do this by running pip install -r requirements.txt in your terminal.

Work In Progress:

  • Dynamic pixel scale extractor
  • Batch Mode Processor with GUI (user clicks on all features of all images)
    • Feature size statistical analysis (emission file, histograms, tables)
  • Feature recognition in extract_all_features.py and statistical analysis
  • Negative mask click implementation

Contributing

Contributions are welcome. Please open an issue to discuss your ideas or submit a pull request with your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

quantumdevicesem's People

Contributors

shanto268 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.