Skip to main content

Training and Prediction

  • This doc provides a high level overview of training and prediction in three repositories. Refer to history section for details.
  • Additional technical information can be found in the README here.
  • Details on environments used can be found here

Models available

  • Vannary provided us models trained on Calgary (CGY), Everett (Eve), District of North Vancouver (DNV) and City of Vancouver (COV) datasets with two configurations:
    1. base covariates
    2. base + additional covariates
  • These models were trained on compute-canada and are available here: GDrive > VS Reasearch > pipe_breaks > saved_models

History

  • Currently, we have 3 repositories:
    • pipe-breaks
    • loe-coe-app
    • pipe-breaks-transfer-learning
  • Repositories came into existence in following order:
  • Models were intially developed on compute-canada, which has different environment requirements. loe-coe-app was made compatible for this, so that models can be used for transfer-learning.
  • Old Flow:
  • New flow:

Workflow

It is easy to debug workflow in pipe-breaks than it is on loe-coe-app, where it is tricky with the streamlit implementation (because of multi threading). The following information is through debugging pipe_breaks.

  1. Notes:

    • pipe-breaks: Original repository for training and prediction. It has the working code and can be used for training using different algorithms, testing and saving the models. Detailed steps can be found in the section following this.
    • loe-coe-App: A streamlit app for pipe-breaks, which provides a shell script that is used to train models and predict.
      • We are fine-tuning the heads in the CCTV pipeline while using RESNET but, we might not be fine tuning heads in transfer learning yet.
    • pipe-breaks-transfer-learning: Using this streamlit app, we use models developed above and test them.
      • Chnages have been made to select models directly from a dropdown.
  2. Observations:

    1. pipe-breaks:

      • This has the CSV files to be used as inputs to the pipe-breaks-transfer-learning app.
      • Using this, we can generate CSV files and models.
      • Files used by the processing step to generate input files, for example DNV, are:
        • 3 files are created from the processing step with the names we provide, in the following order:
          • inputs{utility}_mains_w_survival_data.csv
          • inputs{utility}_output_dataframe.csv
          • outputs{utility}_output_dataframe_filtered.csv
        • 1 file is created after we run the algorithm, using the files from the previous step:
          • {utility}_{algorithm}_partial_hazards.csv: This file has the main_id and partial_hazards of all the pipes.
        • 1 file is created after running compare_results.py, using the file created in previous step, {utility}_mains file and {utility}_breaks file:
          • {utility}_{algorithm}_partial_hazards_main_id.csv: This file has the main_id and partial_hazards of the pipes that broke during the test period.
    2. loe-coe-app:

    • On MSI, this app runs in pipe-breaks environment but is not able to run succesfully due to wrong path references to script_runner.py and .toml files from working directory.
    1. pipe-breaks-transfer-learning:
    • Using models created in environments that have mismatch in requirements may sometimes give index out of bound issues or Module not found errors in the app.
    • This will be most likely be resolved if:
      • the models training and testing are done in similar environments.
      • The environment used to devlop and debug are same
caution

VSCode can sometimes mess with the environments selected while developing. Select correct environment on bottom right corner of vscode before you run the scripts.

Usage

  1. pipe-breaks: Refer to the details on using this here
  2. loe-coe-app:
    1. Create a virtual environment and install the requirements.
    2. Download the models from the google drive or the models generated after running script_runner.py.
    3. Run the streamlit app
    4. Choose the covariates, model and input csv file for predicted output to appear on screen.
  3. pipe-breaks-transfer-learning:
    1. Create a virtual environment and install the requirements, as mentioned in the README.
    2. Import the models generated from loe-coe-app and place them in /trained_models folder.
    3. Launch the streamlit app
    4. Choose the covariates, model and input csv file for predictions to appear on screen.