/** * @license * Copyright 2021 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 mobilenet from '@tensorflow-models/mobilenet'; import { ImageClassifierOptions } from '@tensorflow/tfjs-tflite'; import { BaseTaskModel, TaskModelLoader } from '../task_model'; /** * The canonical ImageClassifier task model for all image classification related * TFJS/TFLite models. */ export interface ImageClassifier extends BaseTaskModel { /** * Performs classification on the given image-like resource, and returns * result. */ classify(img: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, options?: T): Promise; } /** Classification result. */ export interface ImageClassifierResult { classes: Class[]; } /** A single class in the classification result. */ export interface Class { className: string; probability: number; } /** Options for TFLiteMobileNet models. */ export interface TFLiteMobileNetOptions extends ImageClassifierOptions { version?: 1 | 2; alpha?: 0.25 | 0.50 | 0.75 | 1.0; } /** Options for TFLite image classification custom models. */ export interface TFLiteImageClassificationCustomModelOptions extends ImageClassifierOptions { modelUrl: string; } /** Options for TFJS mobilenet model. */ export interface TFJSMobileNetInferenceOptions { topK?: number; } /** The transformer for the TFJS MobileNet model. */ export declare const TFJSMobileNetTransformer: TaskModelLoader, mobilenet.ModelConfig>;