Epigos offers an API that allows you to make predictions from your model. This API is accessible within the Epigos Node SDK.

You’ll need to Create an API Key to Authentication with Epigos AI.

Image classification

You can predict the class or label of an image using the predict() function when you load a classification model.

classification()

Loads classification model deployed on the platform.

ParamTypeDescription
model_idstringThe unique ID of your model deployed on Epigos AI.
import { Epigos } from "@epigosai/epigos-sdk";

const client = new Epigos({ apiKey: "api_key_123" });

// load classification model
const model = client.classification("modelId");

predict()

Makes predictions for the classification model.

ParamTypeDescription
payloaddictDictionary containing prediction parameters

Payload

ParamTypeDescription
imageUrlstringOptional remote url pointing to image the
imageBase64stringOptional Base64-encoded string of the image
confidencenumberOptional confidence threshold used to filter out predictions.

The function expects either imageUrl or imageBase64 to provided else it will raise validation errors.

Example prediction

// make predictions
results = await model.predict({ imageUrl: 'path/to/your/image.jpg' })

console.log(results)
{
   "category" : "cat",
   "confidence" : 0.854,
   "predictions" : [
      {
         "category" : "cat",
         "confidence" : 0.854
      },
      {
         "category" : "dog",
         "confidence" : 0.146
      }
   ]
}

Object detection

You can detect objects in an image using the detect() function when you load an object detection model.

objectDetection()

Loads an object detection model deployed on the platform.

ParamTypeDescription
model_idstringThe unique ID of your model deployed on Epigos AI.
import { Epigos } from "@epigosai/epigos-sdk";

const client = new Epigos({ apiKey: "api_key_123" });

// load object detection model
const model = client.objectDetection("modelId");

detect()

Makes detection for the object detection model.

ParamTypeDescription
payloaddictDictionary containing prediction parameters

Payload

ParamTypeDescription
imageUrlstringOptional remote url pointing to image the
imageBase64stringOptional Base64-encoded string of the image
confidencenumberOptional confidence threshold used to filter out predictions.
optionsobjectOptional options to customize image annotation.

Options

ParamTypeDescription
annotatebooleanOptional annotate flag to specify whether to annotate the image or not.
showProbbooleanOptional show_prob to specify whether detection confidence are shown on the labels.
strokeWidthnumberOptional stroke width to specify bounding box border width.

The function expects either imageUrl or imageBase64 to provided else it will raise validation errors.

Example detection

// make detections
results = await model.detect({ imageUrl: 'path/to/your/image.jpg' })

console.log(results)
{
   "detections": [
        {
            "label": "car",
            "confidence": 0.954,
            "x": 281,
            "y": 187,
            "width": 46,
            "height": 36
        }
    ],
    "image": "<base64 image>",
    "labelsCount": [
        {
            "label": "car",
            "total": 1
        }
    ]
}

Example detection with annotation options

// make detections
results = await model.detect({ imageUrl: 'path/to/your/image.jpg', options: {annotate: true, strokeWidth: 3} })

console.log(results)
{
   "detections": [
        {
            "label": "car",
            "confidence": 0.954,
            "x": 281,
            "y": 187,
            "width": 46,
            "height": 36
        }
    ],
    "image": "<base64 image>",
    "labelsCount": [
        {
            "label": "car",
            "total": 1
        }
    ]
}

Checkout the code on Github