import { BehaviourType } from './behaviours'; import { TeachableModel, ExplainedPredictionsOutput, TMType } from './TeachableModel'; import * as tf from '@tensorflow/tfjs'; import EE from 'eventemitter3'; import { AudioExample } from './gtm-utils/recorder'; export interface ISample { data: HTMLCanvasElement | AudioExample; id: string; } export interface IClassification { label: string; samples: ISample[]; } interface ModelContents { behaviours?: string; zip?: Blob; model?: string; metadata?: string; weights?: ArrayBuffer; } export interface TrainingSettings { epochs: number; learningRate: number; batchSize: number; } export interface PredictionsOutput extends ExplainedPredictionsOutput { nameOfMax: string; indexOfMax: number; failed?: boolean; } declare type ClassifierAppEvents = 'loading' | 'ready' | 'epoch' | 'training' | 'trainingcomplete' | 'error' | 'action'; export declare function createModel(variant: TMType, metadata?: any, model?: tf.io.ModelJSON, weights?: ArrayBuffer): TeachableModel; export default class ClassifierApp extends EE { model?: TeachableModel; behaviours: BehaviourType[]; samples: ISample[][]; projectId?: string; readonly variant: TMType; constructor(variant: TMType, model?: TeachableModel, behaviours?: BehaviourType[], samples?: ISample[][]); getImageSize(): number; isReady(): boolean; draw(image: HTMLCanvasElement): HTMLCanvasElement; estimate(image: HTMLCanvasElement): Promise; setXAICanvas(image: HTMLCanvasElement): void; predict(image: HTMLCanvasElement | AudioExample, staticImageMode?: boolean): Promise; getLabels(): string[]; getLabel(index: number): string; train(labels: string[], samples: ISample[][], settings: TrainingSettings): Promise; static create(variant: TMType): Promise; saveComponents(): Promise; save(): Promise; static load(file: string | Blob): Promise; } export {};