AI Model Library
  • 24 Jul 2023
  • Dark
  • PDF

AI Model Library

  • Dark
  • PDF

Article Summary

Model architectures are presented in the 'AI Library', and are the foundation to beginning model management, versioning and training with various data. Use a public model architecture or add your own from GIT to create the first model version.

To access model architectures in the AI Library - Select "AI Library" button in the model-management module

To return to model-management main page Click on "back to versions"

Public Models

The Dataloop system has several pre-installed and publicly available model architectures, which can be installed in your project and trained with your data to achieve pre-annotations of your labels.

  • ResNet - For image classification
  • yolo-v5 - For box annotations
  • unet - for mask/segmentation (COMING SOON)

Add Your Own Model

Connect your own models to the dataloop system by placing them in GIT repository and allowing Dataloop to access it.

Training models

To train your model in the Dataloop system, it should have a Train function that facilitates the training process you wish to facilitate.

Model Adaptor

The Model Adapter is a python class to create a single API between Dataloop’s platform and your Model. By inheriting from a Dataloop class dl.BaseModelAdapter that facilitates all the necessary functions, all that is left is to create these 4 methods:

  • Train
  • Predict
  • Load (to load model weights)
  • Save (to save model weights)

For example, your model adapter can be:

import dtlpy as dl
import torch
import os
class SimpleModelAdapter(dl.BaseModelAdapter):
    def load(self, local_path, **kwargs):
        print('loading a model')
        self.model = torch.load(os.path.join(local_path, 'model.pth'))
    def save(self, local_path, **kwargs):
        print('saving a model to {}'.format(local_path)), os.path.join(local_path, 'model.pth'))
    def train(self, data_path, output_path, **kwargs):
        print('running a training session')
    def predict(self, batch, **kwargs):
        print('predicting batch of size: {}'.format(len(batch)))
        preds = self.model(batch)
        return preds

Install Your Model (GIT Codebase)

  1. Click on "Import AI Application"

  2. In the "New Model" popup, enter the relevant information to allow connecting to your code on GIT

    1. Model Name - The name you wish to assign to the model when represented and referred to in the Dataloop system
    2. GIT URL
    3. Model description (optional)
    4. Class name (optiona)- the class where you have the model adaptor
    5. Entry poin (optiona) - the python file to use as entry point
    6. Input type expected by the model (image, video etc)
    7. Output expected from the model (box annotation, classification etc)
    8. Tags - optional tags to assign to the model

What's Next