Dataset SDK (Node)
This guide walks through the programmatic steps to build and train a model using the EyePop.ai Node SDK. Youโll learn how to create a dataset, upload and label assets, configure augmentations, and launch trainingโall using API calls.
๐ง Getting Started
EyePop.ai offers a Node SDK to make it easy to work with datasets, assets, annotations, and model training.
Install the SDK:
npm install --save @eyepop.ai/eyepop
Initialize the SDK:
import { EyePopClient } from '@eyepop.ai/eyepop';
const client = new EyePopClient({ apiKey: 'YOUR_API_KEY' });
๐ฆ Dataset Creation
A dataset acts as the core container for your modelโs training data. It defines the type of model youโre training (object or classification) and includes the labels youโll be teaching it to recognize.
Example:
const dataset = await client.createDataset(
'Accessories Demo',
['eye glasses', 'handbag', 'earrings', 'shoes'], // Labels
['object'] // Tags: 'object' for object detection, 'classification' for classification
);
๐ผ๏ธ Asset Upload
You can upload image files to your dataset. These are the raw assets that will be labeled and used during model training.
Example:
const result = await client.uploadAsset(datasetUUID, datasetVersion, file, file.name);
console.log(result.uuid); // Uploaded asset's UUID
๐ท๏ธ Asset Labeling
There are two primary ways to label data:
1. Classification
Assign a single label to the entire image.
Example:
const classificationLabel = {
type: 'ground_truth',
user_review: 'approved',
annotation: {
source_width: 1024,
source_height: 768,
classes: [
{ classLabel: 'eye glasses' },
]
}
};
await client.updateAssetGroundTruth(assetUUID, datasetUUID, datasetVersion, classificationLabel)
2. Object Detection
Label specific regions within the image using bounding boxes.
Example:
const objectDetectionLabel = {
type: 'ground_truth',
user_review: 'approved',
annotation: {
source_width: 1024,
source_height: 768,
objects: [
{
classLabel: 'handbag',
x: 100,
y: 150,
width: 200,
height: 100
}
]
}
};
await client.updateAssetGroundTruth(assetUUID, datasetUUID, datasetVersion, objectDetectionLabel);
โ ๏ธ Auto-labeling is currently managed internally and is not exposed via API at this time.
๐๏ธ Augmentation Configuration (Optional)
Before training, you can configure augmentation parameters like confidence threshold and candidate labels. This helps the model generalize better to new data.
Example:
const augmentationIntent = {
"noise_level": "small",
"upside_down_ok": true,
"color_important": true,
"exists_outdoors": false,
"weather_allowed": false,
"rotation_allowed": "medium",
"occlusion_allowed": false,
"camera_motion_important": false
}
๐ Start Model Training
Once your dataset is ready and labeled, kick off model training. EyePop.ai will automatically choose the appropriate model type (object detection or classification) based on the dataset tags.
Example:
const modelData = {
name: "Accessory Model",
description: "This is my new model",
task: 'object_detection', // or 'image_classification'
pretrained_model_uuid: pretrainedModelUUID, // optional model to start training from - useful for iterative training
extra_params: {
trainer: {
preprocessor: {
augment_intent: { } // your selected augmentations
}
}
}
};
const model = await client.createModel(datasetUUID, datasetVersion, modelData, true);
console.log(model.uuid); // New model UUID
Last updated