Preparing a model that will be used to train data sets in PowerAI Vision
If your custom model will be used to train data sets in the PowerAI Vision framework, your custom model must meet the following requirements.
After the model is properly prepared, upload it to PowerAI Vision by opening the Custom Models page and clicking Browse files. You can then use it to train a data set. Follow these instructions to train a data set; selecting Custom model: Training a model.
Custom model requirements:
- It must be TensorFlow or PyTorch based.
- It must conform to Python 3. Any trained custom models from releases prior to Version 1.1.5 will not work if the custom model only supports Python 2.
- It must implement the MyTrain Python class.
- The MyTrain implementation must reside in a file named train.py in the top level directory of the zip file contents.
- The following import must be added to the train.py file in order to define the
training callbacks:
from train_interface import TrainCallback
- The class name must be MyTrain.
MyTrain Template:
class MyTrain(TrainCallback):
def __init__():
pass
def onPreprocessing(self, labels, images, workspace_path, params):
pass
def onTraining(self, monitor_handler):
pass
def onCompleted(self, model_path):
pass
def onFailed(self, train_status, e, tb_message):
pass