Skip to main content

Inference and Streamlit

Follow these steps after the model is done training.

Goal: Take the training Model and test data and run inference on the test data. The inference uses the trained model to identify if test frames have a defect and what defect the model infers that it has. The results will be given along with a prediction confidence value between 0 and 1 the closer it is to 1 the higher the probability that the image does actually have the predicted defect.

fastai_multi_label_predict.py:

  • ‘frames_test’ table read into dataframe from sql database.
  • Dataframe’s column which contains the frame names is loaded into a dataloader.
  • Model performs inference on frames using the dataloader.
  • Inference results are written into ‘predictions’ table.
  • Inference results are unpivoted
  • Unpivoted inference results are written into another table.

Goal: This is the entry point for the streamlit app.The streamlit app currently displays a carousel of images that the user can run inference on based on previously run models. Currently the streamlit app does the inference on the frame when you click on it. You are also able to choose the model to use for the inference. Therefore you should theoretically be able to get the inference based on any trained model. In the future we will be taking the inference out of the streamlit app and only allowing the data view of the results generated by the previous process. This will marry the output to a specific model to the point where we should not allow the user to select a given model.

AI-prediction.py:

  • Modify select query to select the desired frames from prediction process
  • After running the streamlit app, view the frames on the carousel.
  • Select a model from the sidebar
  • Click on a frame in the carousel.
  • After clicking on the frame, the model will perform a prediction and display the results in a tabular format.