Skip to main content
Version: Current

Image Classification Actions

  • os.openImageClassifier(options: ImageClassifierOptions): Promise<void>

    Opens the image classifier with the given options. Returns a promise that resolves once the image classifier has been opened.

    Sends the @onImageClassifierOpened shout once opened and the @onImageClassified shout every time an image has been classified.

    The first parameter is a ImageClassifierOptions and is the options that should be used for the image classifier.

    Examples
    Open the image classifier.
    await os.openImageClassifier({
    modelUrl: 'MY_MODEL_URL'
    });
    Open the image classifier with a specific camera.
    await os.openImageClassifier({
    modelUrl: 'MY_MODEL_URL',
    cameraType: 'front'
    });
  • os.classifyImages(options: ClassifyImagesOptions): Promise<ClassifyImagesResult>

    Classifies the given images using the image classifier. Returns a promise that resolves with the results of the classification.

    The first parameter is a ClassifyImagesOptions and is the options that should be used for the image classification.

    Examples
    Classify the given images.
    const files = await os.showUploadFiles()
    const classify = await os.classifyImages({
    modelUrl: "MY_MODEL_URL",
    images: files.map((file) => {
    return {file}
    })
    })
  • os.closeImageClassifier(): Promise<void>

    Closes the image classifier. Returns a promise that resolves once the image classifier has been closed.

    Also sends the @onImageClassifierClosed shout once closed.

    Examples
    Close the image classifier.
    await os.closeImageClassifier();