UNPKG

@huggingface/transformers

Version:

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!

29 lines (26 loc) • 1.16 kB
import { PreTrainedModel } from '../modeling_utils.js'; import { ModelOutput } from '../modeling_outputs.js'; import { Tensor } from '../../utils/tensor.js'; export class YolosPreTrainedModel extends PreTrainedModel {} export class YolosModel extends YolosPreTrainedModel {} export class YolosForObjectDetection extends YolosPreTrainedModel { /** * @param {any} model_inputs */ async _call(model_inputs) { return new YolosObjectDetectionOutput(await super._call(model_inputs)); } } export class YolosObjectDetectionOutput extends ModelOutput { /** * @param {Object} output The output of the model. * @param {Tensor} output.logits Classification logits (including no-object) for all queries. * @param {Tensor} output.pred_boxes Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). * These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding). */ constructor({ logits, pred_boxes }) { super(); this.logits = logits; this.pred_boxes = pred_boxes; } }