UNPKG

yolo-helpers

Version:

Helper functions to use models converted from YOLO in browser and Node.js

32 lines (31 loc) 1.13 kB
import * as tf from '@tensorflow/tfjs-node'; import { DecodeSegmentArgs } from './common'; import { ImageInput } from '../tensorflow/node'; export * from './common'; export type DetectSegmentArgs = { model: tf.InferenceModel; /** used for image resize when necessary, auto inferred from model shape */ input_shape?: { width: number; height: number; }; } & Omit<DecodeSegmentArgs, 'output_boxes' | 'output_masks'> & ImageInput; /** * boxes features: * - x, y, width, height * - highest confidence, class_index * - mask coefficients for each channel * * mask features: * - [height, width, channel]: 0 for background, 1 for object * * 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 detectSegment(args: DetectSegmentArgs): Promise<import("./common").SegmentResult>; /** * Sync version of `detectSegment`. */ export declare function detectSegmentSync(args: DetectSegmentArgs): import("./common").SegmentResult;