/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ import * as tf from '@tensorflow/tfjs'; export declare const IMAGE_SIZE = 224; export declare const MODEL_BASE_URL = "https://tmstore.blob.core.windows.net/models"; /** * the metadata to describe the model's creation, * includes the labels associated with the classes * and versioning information from training. */ export interface Metadata { tfjsVersion: string; tmVersion?: string; packageVersion: string; packageName: string; modelName?: string; timeStamp?: string; labels: string[]; userMetadata?: unknown; grayscale?: boolean; imageSize?: number; } export interface ModelOptions { version?: number; checkpointUrl?: string; alpha?: number; trainingLayer?: string; modelBaseUrl?: string; } /** * Receives a Metadata object and fills in the optional fields such as timeStamp * @param data a Metadata object */ export declare const fillMetadata: (data: Partial) => Metadata; export declare type ClassifierInputSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap; /** * Computes the probabilities of the topK classes given logits by computing * softmax to get probabilities and then sorting the probabilities. * @param logits Tensor representing the logits from MobileNet. * @param topK The number of top predictions to show. */ export declare function getTopKClasses(labels: string[], logits: tf.Tensor, topK?: number): Promise; /** * load the base mobilenet model * @param modelOptions options determining what model to load */ export declare function loadTruncatedMobileNet(modelOptions?: ModelOptions): Promise;