Skip to content

Visual inspection

Software for automatic visual inspection of ATLAS ITk Pixel module pads before wire-bonding.

To deploy your own instance of the app:

  1. Pull the Docker image of the app from container registry.

  2. Change the configuration of the docker image. For more info see the Section Specifications.

  3. Deploy it of your machine.

  4. Once launched, go to the address: IP_of_machine:9003/. Online API, documentation with Swagger: IP_of_machine:9003/docs.


Specifications

SFTP

  • This server uses a private SFTP connection to communicate with EOS.
  • SFTP connection is configured with environment variables:
    • SFTP_USER: EOS username.
    • SFTP_PASSWORD: EOS password.
    • SFTP_HOST: EOS host.
    • SFTP_PROJECT_PATH: EOS root project path (the one containing models/ and modules/).
  • Some files are required to be present in the EOS project directory:
    • SFTP_PROJECT_PATH/
    • models/
    • default.pckl
    • config.yaml

MongoDB (database)

  • This server uses a MongoDB database to store the data.
  • MongoDB's connection is configured with environment variables:
    • MONGO_USER: MongoDB username.
    • MONGO_PASSWORD: MongoDB password.
    • MONGO_HOST: MongoDB host.
    • MONGO_DATABASE: MongoDB database name.
  • Module model (stored in modules collection):
    • _id: module unique identifier (generated by MongoDb for each entry)
    • name: module name
    • description: module description
    • uploaded_by: user who uploaded the module
    • uploaded_at: date when the module was uploaded
    • last_updated_at: date when the module was last updated
    • right & left: Sides of the module
      • tag: tag of the side (left or right)
      • tile_count: number of tiles in the side
      • verified_masks: List of boolean values indicating if the mask of the tile has been verified
      • original: Original image information
        • thumbnail: Thumbnail version of the image
          • src_id: Image identifier (not tiled)
          • tiled_id: List of image identifiers (tiles ids)
        • full: width of the original image
          • src_id: Image identifier (not tiled)
          • tiled_id: List of image identifiers (tiles ids)
      • preprocessed:
        • ... Same model as original, with the preprocessed image data
      • anomaly_map:
        • ... Same model as original, with the colorized anomaly map (the nice one)
      • mask:
        • ... Same model as original, with the original mask from ML (no corrections)
      • corrected_mask:
        • ... Same model as original, with the original mask from ML (with corrections)
  • GridFS is used to store the images and the masks, so a simple request to the database is not enough to get the image data, but hopefully you can use /api/images/{image_id} to get the image in your browser.

Cluster

NOT REQUIRED TO USE THE APPLICATION

The idea is to have access to a cluster to run the ML model on the images, which can be done locally but will take a significant amount of time.

  • The connection is configured with environment variables:
    • CLUSTER_SWITCH: True if use cluster, False if run on the machine.
    • CLUSTER_USER: Cluster username.
    • CLUSTER_PASSWORD: Cluster password.
    • CLUSTER_HOST: Cluster host.
    • CLUSTER_ROOTDIR: Cluster root project path, where the evaluations will occur.
    • GITLAB_USER: Gitlab username, used to pull the ML image.
    • GITLAB_PASSWORD: Gitlab password, used to pull the ML image.
    • GITLAB_PASSWORD: Gitlab password
    • nb: No native tunnelling is implemented.

Workflow:

  • Connection to the Cluster
  • Creation of the CLUSTER_ROOTDIR directory
  • Upload of the models necessary for the evaluation (previously downloaded from EOS)
  • Connection to the Gitlab where the Docker image of the ML is stored
  • Pull of the Docker image
  • Upload of the image to evaluate to the Cluster
  • Run of the Docker image as a Singularity container
  • Wait for the evaluation to finish (repetition of sacct command)
  • Download of the results from the Cluster

Front-end (dart Flutter)

The entire flutter app is in the lib/ directory.

Back-end (python FastAPI)

The application is in the backend/ directory.


Quickstart (localhost)

Flutter local installation

1
2
3
git clone https://github.com/flutter/flutter.git
export PATH="$(pwd)/flutter/bin:$PATH"
flutter upgrade

Application setup

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
git clone https://gitlab.cern.ch/SaclayITk/visualinspection/visual-inspection-gui.git itk_visual_inspection --recursive
cd itk_visual_inspection

echo "Building the web application..."
flutter config --no-analytics --enable-web
flutter create --project-name=itk_vi_gui --platforms=web .
flutter pub get
flutter build web --release

echo "Installing dependencies..."
cd backend
python3 -m venv venv
source venv/bin/activate
pip3 install --upgrade pip
pip install -r requirements.txt
pip install -r server_requirements.txt

echo "Starting the server..."
cp -r ../build/web ./web
python3 -m uvicorn app.main:app --reload

Then go to http://localhost:8000.