yolo-helpers
Version:
Helper functions to use models converted from YOLO in browser and Node.js
28 lines (27 loc) • 942 B
TypeScript
import * as tf from '@tensorflow/tfjs-node';
import { DecodeBoxArgs } from './common';
import { ImageInput } from '../tensorflow/node';
export * from './common';
export type DetectBoxArgs = {
model: tf.InferenceModel;
/** used for image resize when necessary, auto inferred from model shape */
input_shape?: {
width: number;
height: number;
};
} & Omit<DecodeBoxArgs, 'output'> & ImageInput;
/**
* box features:
* - x, y, width, height
* - highest confidence, class_index
*
* The x, y, width, height are in pixel unit, NOT normalized in the range of [0, 1].
* The the pixel units are scaled to the input_shape.
*
* The confidence are already normalized between 0 to 1.
*/
export declare function detectBox(args: DetectBoxArgs): Promise<import("./common").BoxResult>;
/**
* Sync version of `detectBox`.
*/
export declare function detectBoxSync(args: DetectBoxArgs): import("./common").BoxResult;