POST
/
api
/
{projectId}
/
jobs
/
train
/
keras
/
{learnId}
Train model (Keras)
curl --request POST \
  --url https://studio.edgeimpulse.com/v1/api/{projectId}/jobs/train/keras/{learnId} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "mode": "expert",
  "minimumConfidenceRating": 123,
  "selectedModelType": "int8",
  "script": "<string>",
  "visualLayers": [
    {
      "type": "dense",
      "neurons": 123,
      "kernelSize": 123,
      "dropoutRate": 123,
      "columns": 123,
      "stack": 123,
      "enabled": true,
      "organizationModelId": 123
    }
  ],
  "trainingCycles": 123,
  "learningRate": 123,
  "batchSize": 123,
  "trainTestSplit": 123,
  "autoClassWeights": true,
  "useLearnedOptimizer": true,
  "augmentationPolicyImage": "none",
  "augmentationPolicySpectrogram": {
    "enabled": true,
    "warping": true,
    "freqMasking": "none",
    "timeMasking": "none",
    "gaussianNoise": "none"
  },
  "profileInt8": true,
  "skipEmbeddingsAndMemory": true,
  "akidaEdgeLearningConfig": {
    "enabled": true,
    "additionalClasses": 123,
    "neuronsPerClass": 123
  },
  "customValidationMetadataKey": "<string>",
  "showAdvancedTrainingSettings": true,
  "showAugmentationTrainingSettings": true,
  "customParameters": {},
  "anomalyCapacity": "low",
  "lastShownModelVariant": "int8",
  "blockParameters": {
    "backbone": "<string>",
    "numLayers": 123,
    "poolSize": 123,
    "samplingRatio": 123,
    "numNearestNeighbors": 123
  }
}'
{
  "success": true,
  "error": "<string>",
  "id": 12873488112
}

Authorizations

x-api-key
string
header
required

Path Parameters

projectId
integer
required

Project ID

learnId
integer
required

Learn Block ID, use the impulse functions to retrieve the ID

Body

application/json

Only fields defined in this object are set

mode
enum<string>

Whether to use visual or expert mode.

Available options:
expert,
visual
minimumConfidenceRating
number

DEPRECATED, use "setImpulseThresholds" instead. Minimum confidence score, if the neural network scores a sample below this threshold it will be flagged as uncertain.

selectedModelType
enum<string>

The model type to select, as described in the model metadata call.

Available options:
int8,
float32,
akida,
requiresRetrain
script
string

Raw Keras script (only used in expert mode)

visualLayers
object[]

The visual layers for the neural network (only in visual mode).

trainingCycles
integer

Number of training cycles (only in visual mode).

learningRate
number

Learning rate (between 0 and 1) (only in visual mode).

batchSize
number

Batch size used during training (only in visual mode).

trainTestSplit
number

Train/test split (between 0 and 1)

autoClassWeights
boolean

Whether to automatically balance class weights, use this for skewed datasets.

useLearnedOptimizer
boolean

Use learned optimizer and ignore learning rate.

augmentationPolicyImage
enum<string>

The data augmentation policy to use with image input

Available options:
none,
all
augmentationPolicySpectrogram
object
profileInt8
boolean

Whether to profile the i8 model (might take a very long time)

skipEmbeddingsAndMemory
boolean

If set, skips creating embeddings and measuring memory (used in tests)

akidaEdgeLearningConfig
object
customValidationMetadataKey
string

If the 'custom validation split' experiment is enabled, this metadata key is used to prevent group data leakage between train and validation datasets.

showAdvancedTrainingSettings
boolean

Whether the 'Advanced training settings' UI element should be expanded.

showAugmentationTrainingSettings
boolean

Whether the 'Augmentation training settings' UI element should be expanded.

customParameters
object

Training parameters, this list depends on the list of parameters that the model exposes.

anomalyCapacity
enum<string>

Capacity level for visual anomaly detection. Determines which set of default configurations to use. The higher capacity, the higher number of (Gaussian) components, and the more adapted the model becomes to the original distribution

Available options:
low,
medium,
high
lastShownModelVariant
enum<string>

Last shown variant on the Keras screen. Used to keep the same view after refreshing.

Available options:
int8,
float32,
akida
blockParameters
object

Training parameters specific to the type of the learn block. Parameters may be adjusted depending on the model defined in the visual layers. Used for our built-in blocks.

Response

200 - application/json

OK

success
boolean
required

Whether the operation succeeded

id
integer
required

Job identifier. Status updates will include this identifier.

Example:

12873488112

error
string

Optional error description (set if 'success' was false)