> For the complete documentation index, see [llms.txt](https://boinc-ai.gitbook.io/transformers.js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boinc-ai.gitbook.io/transformers.js/api-reference/processors.md).

# Processors

## processors

Processors are used to prepare non-textual inputs (e.g., image or audio) for a model.

**Example:** Using a `WhisperProcessor` to prepare an audio input for a model.

Copied

```
import { AutoProcessor, read_audio } from '@xenova/transformers';

let processor = await AutoProcessor.from_pretrained('openai/whisper-tiny.en');
let audio = await read_audio('https://boincai.com/datasets/Narsil/asr_dummy/resolve/main/mlk.flac', 16000);
let { input_features } = await processor(audio);
// Tensor {
//   data: Float32Array(240000) [0.4752984642982483, 0.5597258806228638, 0.56434166431427, ...],
//   dims: [1, 80, 3000],
//   type: 'float32',
//   size: 240000,
// }
```

* [processors](https://huggingface.co/docs/transformers.js/api/processors#module_processors)
  * *static*
    * [.FeatureExtractor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.FeatureExtractor) ⇐ `Callable`
      * [`new FeatureExtractor(config)`](https://huggingface.co/docs/transformers.js/api/processors#new_module_processors.FeatureExtractor_new)
    * [.ImageFeatureExtractor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor) ⇐ `FeatureExtractor`
      * [`new ImageFeatureExtractor(config)`](https://huggingface.co/docs/transformers.js/api/processors#new_module_processors.ImageFeatureExtractor_new)
      * [`.thumbnail(image, size, [resample])`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor+thumbnail) ⇒ `Promise.<RawImage>`
      * [`.preprocess(image)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor+preprocess) ⇒ `Promise.<PreprocessedImage>`
      * [`._call(images, ...args)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor+_call) ⇒ `Promise.<ImageFeatureExtractorResult>`
    * [.DetrFeatureExtractor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor) ⇐ `ImageFeatureExtractor`
      * [`._call(urls)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+_call) ⇒ `Promise.<DetrFeatureExtractorResult>`
      * [`.post_process_object_detection()`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+post_process_object_detection) : `post_process_object_detection`
      * [`.remove_low_and_no_objects(class_logits, mask_logits, object_mask_threshold, num_labels)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+remove_low_and_no_objects) ⇒ `*`
      * [`.check_segment_validity(mask_labels, mask_probs, k, mask_threshold, overlap_mask_area_threshold)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+check_segment_validity) ⇒ `*`
      * [`.compute_segments(mask_probs, pred_scores, pred_labels, mask_threshold, overlap_mask_area_threshold, label_ids_to_fuse, target_size)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+compute_segments) ⇒ `*`
      * [`.post_process_panoptic_segmentation(outputs, [threshold], [mask_threshold], [overlap_mask_area_threshold], [label_ids_to_fuse], [target_sizes])`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+post_process_panoptic_segmentation) ⇒ `Array.<{segmentation: Tensor, segments_info: Array<{id: number, label_id: number, score: number}>}>`
    * [.Processor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.Processor) ⇐ `Callable`
      * [`new Processor(feature_extractor)`](https://huggingface.co/docs/transformers.js/api/processors#new_module_processors.Processor_new)
      * [`._call(input, ...args)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.Processor+_call) ⇒ `Promise.<any>`
    * [.WhisperProcessor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.WhisperProcessor) ⇐ `Processor`
      * [`._call(audio)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.WhisperProcessor+_call) ⇒ `Promise.<any>`
    * [.AutoProcessor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.AutoProcessor)
      * [`.from_pretrained(pretrained_model_name_or_path, options)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.AutoProcessor.from_pretrained) ⇒ `Promise.<Processor>`
  * *inner*
    * [`~center_to_corners_format(arr)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..center_to_corners_format) ⇒ `Array.<number>`
    * [`~post_process_object_detection(outputs)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..post_process_object_detection) ⇒ `Array.<Object>`
      * [`~box`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..post_process_object_detection..box) : `Array.<number>`
    * [`~HeightWidth`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..HeightWidth) : `*`
    * [`~ImageFeatureExtractorResult`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..ImageFeatureExtractorResult) : `object`
    * [`~PreprocessedImage`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..PreprocessedImage) : `object`
    * [`~DetrFeatureExtractorResult`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..DetrFeatureExtractorResult) : `object`
    * [`~SamImageProcessorResult`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..SamImageProcessorResult) : `object`

***

### processors.FeatureExtractor ⇐ \<code> Callable \</code>

Base class for feature extractors.

**Kind**: static class of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Extends**: `Callable`

***

#### new FeatureExtractor(config)

Constructs a new FeatureExtractor instance.

| Param  | Type     | Description                                  |
| ------ | -------- | -------------------------------------------- |
| config | `Object` | The configuration for the feature extractor. |

***

### processors.ImageFeatureExtractor ⇐ \<code> FeatureExtractor \</code>

Feature extractor for image models.

**Kind**: static class of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Extends**: `FeatureExtractor`

* [.ImageFeatureExtractor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor) ⇐ `FeatureExtractor`
  * [`new ImageFeatureExtractor(config)`](https://huggingface.co/docs/transformers.js/api/processors#new_module_processors.ImageFeatureExtractor_new)
  * [`.thumbnail(image, size, [resample])`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor+thumbnail) ⇒ `Promise.<RawImage>`
  * [`.preprocess(image)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor+preprocess) ⇒ `Promise.<PreprocessedImage>`
  * [`._call(images, ...args)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor+_call) ⇒ `Promise.<ImageFeatureExtractorResult>`

***

#### new ImageFeatureExtractor(config)

Constructs a new ImageFeatureExtractor instance.

| Param                  | Type             | Description                                                    |
| ---------------------- | ---------------- | -------------------------------------------------------------- |
| config                 | `Object`         | The configuration for the feature extractor.                   |
| config.image\_mean     | `Array.<number>` | The mean values for image normalization.                       |
| config.image\_std      | `Array.<number>` | The standard deviation values for image normalization.         |
| config.do\_rescale     | `boolean`        | Whether to rescale the image pixel values to the \[0,1] range. |
| config.rescale\_factor | `number`         | The factor to use for rescaling the image pixel values.        |
| config.do\_normalize   | `boolean`        | Whether to normalize the image pixel values.                   |
| config.do\_resize      | `boolean`        | Whether to resize the image.                                   |
| config.resample        | `number`         | What method to use for resampling.                             |
| config.size            | `number`         | The size to resize the image to.                               |

***

#### imageFeatureExtractor.thumbnail(image, size, \[resample]) ⇒ \<code> Promise. < RawImage > \</code>

Resize the image to make a thumbnail. The image is resized so that no dimension is larger than any corresponding dimension of the specified size.

**Kind**: instance method of [`ImageFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor)\
**Returns**: `Promise.<RawImage>` - The resized image.

| Param       | Type                                               | Default | Description                                                  |
| ----------- | -------------------------------------------------- | ------- | ------------------------------------------------------------ |
| image       | `RawImage`                                         |         | The image to be resized.                                     |
| size        | `Object`                                           |         | The size `{"height": h, "width": w}` to resize the image to. |
| \[resample] | `string` \| `0` \| `1` \| `2` \| `3` \| `4` \| `5` | `2`     | The resampling filter to use.                                |

***

#### imageFeatureExtractor.preprocess(image) ⇒ \<code> Promise. < PreprocessedImage > \</code>

Preprocesses the given image.

**Kind**: instance method of [`ImageFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor)\
**Returns**: `Promise.<PreprocessedImage>` - The preprocessed image.

| Param | Type       | Description              |
| ----- | ---------- | ------------------------ |
| image | `RawImage` | The image to preprocess. |

***

#### imageFeatureExtractor.\_call(images, ...args) ⇒ \<code> Promise. < ImageFeatureExtractorResult > \</code>

Calls the feature extraction process on an array of image URLs, preprocesses each image, and concatenates the resulting features into a single Tensor.

**Kind**: instance method of [`ImageFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.ImageFeatureExtractor)\
**Returns**: `Promise.<ImageFeatureExtractorResult>` - An object containing the concatenated pixel values (and other metadata) of the preprocessed images.

| Param   | Type          | Description                                          |
| ------- | ------------- | ---------------------------------------------------- |
| images  | `Array.<any>` | The URL(s) of the image(s) to extract features from. |
| ...args | `any`         | Additional arguments.                                |

***

### processors.DetrFeatureExtractor ⇐ \<code> ImageFeatureExtractor \</code>

Detr Feature Extractor.

**Kind**: static class of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Extends**: `ImageFeatureExtractor`

* [.DetrFeatureExtractor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor) ⇐ `ImageFeatureExtractor`
  * [`._call(urls)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+_call) ⇒ `Promise.<DetrFeatureExtractorResult>`
  * [`.post_process_object_detection()`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+post_process_object_detection) : `post_process_object_detection`
  * [`.remove_low_and_no_objects(class_logits, mask_logits, object_mask_threshold, num_labels)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+remove_low_and_no_objects) ⇒ `*`
  * [`.check_segment_validity(mask_labels, mask_probs, k, mask_threshold, overlap_mask_area_threshold)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+check_segment_validity) ⇒ `*`
  * [`.compute_segments(mask_probs, pred_scores, pred_labels, mask_threshold, overlap_mask_area_threshold, label_ids_to_fuse, target_size)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+compute_segments) ⇒ `*`
  * [`.post_process_panoptic_segmentation(outputs, [threshold], [mask_threshold], [overlap_mask_area_threshold], [label_ids_to_fuse], [target_sizes])`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor+post_process_panoptic_segmentation) ⇒ `Array.<{segmentation: Tensor, segments_info: Array<{id: number, label_id: number, score: number}>}>`

***

#### detrFeatureExtractor.\_call(urls) ⇒ \<code> Promise. < DetrFeatureExtractorResult > \</code>

Calls the feature extraction process on an array of image URLs, preprocesses each image, and concatenates the resulting features into a single Tensor.

**Kind**: instance method of [`DetrFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor)\
**Returns**: `Promise.<DetrFeatureExtractorResult>` - An object containing the concatenated pixel values of the preprocessed images.

| Param | Type          | Description                                          |
| ----- | ------------- | ---------------------------------------------------- |
| urls  | `Array.<any>` | The URL(s) of the image(s) to extract features from. |

***

#### detrFeatureExtractor.post\_process\_object\_detection() : \<code> post\_process\_object\_detection \</code>

**Kind**: instance method of [`DetrFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor)

***

#### detrFeatureExtractor.remove\_low\_and\_no\_objects(class\_logits, mask\_logits, object\_mask\_threshold, num\_labels) ⇒ \<code> \* \</code>

Binarize the given masks using `object_mask_threshold`, it returns the associated values of `masks`, `scores` and `labels`.

**Kind**: instance method of [`DetrFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor)\
**Returns**: `*` - The binarized masks, the scores, and the labels.

| Param                   | Type     | Description                                          |
| ----------------------- | -------- | ---------------------------------------------------- |
| class\_logits           | `Tensor` | The class logits.                                    |
| mask\_logits            | `Tensor` | The mask logits.                                     |
| object\_mask\_threshold | `number` | A number between 0 and 1 used to binarize the masks. |
| num\_labels             | `number` | The number of labels.                                |

***

#### detrFeatureExtractor.check\_segment\_validity(mask\_labels, mask\_probs, k, mask\_threshold, overlap\_mask\_area\_threshold) ⇒ \<code> \* \</code>

Checks whether the segment is valid or not.

**Kind**: instance method of [`DetrFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor)\
**Returns**: `*` - Whether the segment is valid or not, and the indices of the valid labels.

| Param                          | Type             | Default | Description                                |
| ------------------------------ | ---------------- | ------- | ------------------------------------------ |
| mask\_labels                   | `Int32Array`     |         | Labels for each pixel in the mask.         |
| mask\_probs                    | `Array.<Tensor>` |         | Probabilities for each pixel in the masks. |
| k                              | `number`         |         | The class id of the segment.               |
| mask\_threshold                | `number`         | `0.5`   | The mask threshold.                        |
| overlap\_mask\_area\_threshold | `number`         | `0.8`   | The overlap mask area threshold.           |

***

#### detrFeatureExtractor.compute\_segments(mask\_probs, pred\_scores, pred\_labels, mask\_threshold, overlap\_mask\_area\_threshold, label\_ids\_to\_fuse, target\_size) ⇒ \<code> \* \</code>

Computes the segments.

**Kind**: instance method of [`DetrFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor)\
**Returns**: `*` - The computed segments.

| Param                          | Type             | Default | Description                      |
| ------------------------------ | ---------------- | ------- | -------------------------------- |
| mask\_probs                    | `Array.<Tensor>` |         | The mask probabilities.          |
| pred\_scores                   | `Array.<number>` |         | The predicted scores.            |
| pred\_labels                   | `Array.<number>` |         | The predicted labels.            |
| mask\_threshold                | `number`         |         | The mask threshold.              |
| overlap\_mask\_area\_threshold | `number`         |         | The overlap mask area threshold. |
| label\_ids\_to\_fuse           | `Set.<number>`   |         | The label ids to fuse.           |
| target\_size                   | `Array.<number>` |         | The target size of the image.    |

***

#### detrFeatureExtractor.post\_process\_panoptic\_segmentation(outputs, \[threshold], \[mask\_threshold], \[overlap\_mask\_area\_threshold], \[label\_ids\_to\_fuse], \[target\_sizes]) ⇒ \<code> Array. < {segmentation: Tensor, segments\_info: Array < {id: number, label\_id: number, score: number} > } > \</code>

Post-process the model output to generate the final panoptic segmentation.

**Kind**: instance method of [`DetrFeatureExtractor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.DetrFeatureExtractor)

| Param                             | Type                    | Default | Description                                                                                                    |
| --------------------------------- | ----------------------- | ------- | -------------------------------------------------------------------------------------------------------------- |
| outputs                           | `*`                     |         | The model output to post process                                                                               |
| \[threshold]                      | `number`                | `0.5`   | The probability score threshold to keep predicted instance masks.                                              |
| \[mask\_threshold]                | `number`                | `0.5`   | Threshold to use when turning the predicted masks into binary values.                                          |
| \[overlap\_mask\_area\_threshold] | `number`                | `0.8`   | The overlap mask area threshold to merge or discard small disconnected parts within each binary instance mask. |
| \[label\_ids\_to\_fuse]           | `Set.<number>`          |         | The labels in this state will have all their instances be fused together.                                      |
| \[target\_sizes]                  | `Array.<Array<number>>` |         | The target sizes to resize the masks to.                                                                       |

***

### processors.Processor ⇐ \<code> Callable \</code>

Represents a Processor that extracts features from an input.

**Kind**: static class of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Extends**: `Callable`

* [.Processor](https://huggingface.co/docs/transformers.js/api/processors#module_processors.Processor) ⇐ `Callable`
  * [`new Processor(feature_extractor)`](https://huggingface.co/docs/transformers.js/api/processors#new_module_processors.Processor_new)
  * [`._call(input, ...args)`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.Processor+_call) ⇒ `Promise.<any>`

***

#### new Processor(feature\_extractor)

Creates a new Processor with the given feature extractor.

| Param              | Type               | Description                                           |
| ------------------ | ------------------ | ----------------------------------------------------- |
| feature\_extractor | `FeatureExtractor` | The function used to extract features from the input. |

***

#### processor.\_call(input, ...args) ⇒ \<code> Promise. < any > \</code>

Calls the feature\_extractor function with the given input.

**Kind**: instance method of [`Processor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.Processor)\
**Returns**: `Promise.<any>` - A Promise that resolves with the extracted features.

| Param   | Type  | Description                         |
| ------- | ----- | ----------------------------------- |
| input   | `any` | The input to extract features from. |
| ...args | `any` | Additional arguments.               |

***

### processors.WhisperProcessor ⇐ \<code> Processor \</code>

Represents a WhisperProcessor that extracts features from an audio input.

**Kind**: static class of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Extends**: `Processor`

***

#### whisperProcessor.\_call(audio) ⇒ \<code> Promise. < any > \</code>

Calls the feature\_extractor function with the given audio input.

**Kind**: instance method of [`WhisperProcessor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.WhisperProcessor)\
**Returns**: `Promise.<any>` - A Promise that resolves with the extracted features.

| Param | Type  | Description                               |
| ----- | ----- | ----------------------------------------- |
| audio | `any` | The audio input to extract features from. |

***

### processors.AutoProcessor

Helper class which is used to instantiate pretrained processors with the `from_pretrained` function. The chosen processor class is determined by the type specified in the processor config.

**Example:** Load a processor using `from_pretrained`.

Copied

```
let processor = await AutoProcessor.from_pretrained('openai/whisper-tiny.en');
```

**Example:** Run an image through a processor.

Copied

```
let processor = await AutoProcessor.from_pretrained('Xenova/clip-vit-base-patch16');
let image = await RawImage.read('https://boincai.com/datasets/Xenova/transformers.js-docs/resolve/main/football-match.jpg');
let image_inputs = await processor(image);
// {
//   "pixel_values": {
//     "dims": [ 1, 3, 224, 224 ],
//     "type": "float32",
//     "data": Float32Array [ -1.558687686920166, -1.558687686920166, -1.5440893173217773, ... ],
//     "size": 150528
//   },
//   "original_sizes": [
//     [ 533, 800 ]
//   ],
//   "reshaped_input_sizes": [
//     [ 224, 224 ]
//   ]
// }
```

**Kind**: static class of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)

***

#### AutoProcessor.from\_pretrained(pretrained\_model\_name\_or\_path, options) ⇒ \<code> Promise. < Processor > \</code>

Instantiate one of the processor classes of the library from a pretrained model.

The processor class to instantiate is selected based on the `feature_extractor_type` property of the config object (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)

**Kind**: static method of [`AutoProcessor`](https://huggingface.co/docs/transformers.js/api/processors#module_processors.AutoProcessor)\
**Returns**: `Promise.<Processor>` - A new instance of the Processor class.

| Param                             | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| pretrained\_model\_name\_or\_path | `string` | <p>The name or path of the pretrained model. Can be either:</p><ul><li>A string, the <em>model id</em> of a pretrained processor hosted inside a model repo on boincai.com. Valid model ids can be located at the root-level, like <code>bert-base-uncased</code>, or namespaced under a user or organization name, like <code>dbmdz/bert-base-german-cased</code>.</li><li>A path to a <em>directory</em> containing processor files, e.g., <code>./my\_model\_directory/</code>.</li></ul> |
| options                           | `*`      | Additional options for loading the processor.                                                                                                                                                                                                                                                                                                                                                                                                                                                |

***

### processors\~center\_to\_corners\_format(arr) ⇒ \<code> Array. < number > \</code>

Converts bounding boxes from center format to corners format.

**Kind**: inner method of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Returns**: `Array.<number>` - The coodinates for the top-left and bottom-right corners of the box (top\_left\_x, top\_left\_y, bottom\_right\_x, bottom\_right\_y)

| Param | Type             | Description                                                                                                     |
| ----- | ---------------- | --------------------------------------------------------------------------------------------------------------- |
| arr   | `Array.<number>` | The coordinate for the center of the box and its width, height dimensions (center\_x, center\_y, width, height) |

***

### processors\~post\_process\_object\_detection(outputs) ⇒ \<code> Array. < Object > \</code>

Post-processes the outputs of the model (for object detection).

**Kind**: inner method of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Returns**: `Array.<Object>` - An array of objects containing the post-processed outputs.

| Param               | Type     | Description                                          |
| ------------------- | -------- | ---------------------------------------------------- |
| outputs             | `Object` | The outputs of the model that must be post-processed |
| outputs.logits      | `Tensor` | The logits                                           |
| outputs.pred\_boxes | `Tensor` | The predicted boxes.                                 |

***

#### post\_process\_object\_detection\~box : \<code> Array. < number > \</code>

**Kind**: inner property of [`post_process_object_detection`](https://huggingface.co/docs/transformers.js/api/processors#module_processors..post_process_object_detection)

***

### processors\~HeightWidth : \<code> \* \</code>

Named tuple to indicate the order we are using is (height x width), even though the Graphics’ industry standard is (width x height).

**Kind**: inner typedef of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)

***

### processors\~ImageFeatureExtractorResult : \<code> object \</code>

**Kind**: inner typedef of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Properties**

| Name                   | Type                  | Description                                            |
| ---------------------- | --------------------- | ------------------------------------------------------ |
| pixel\_values          | `Tensor`              | The pixel values of the batched preprocessed images.   |
| original\_sizes        | `Array.<HeightWidth>` | Array of two-dimensional tuples like \[\[480, 640]].   |
| reshaped\_input\_sizes | `Array.<HeightWidth>` | Array of two-dimensional tuples like \[\[1000, 1330]]. |

***

### processors\~PreprocessedImage : \<code> object \</code>

**Kind**: inner typedef of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Properties**

| Name                  | Type          | Description                                 |
| --------------------- | ------------- | ------------------------------------------- |
| original\_size        | `HeightWidth` | The original size of the image.             |
| reshaped\_input\_size | `HeightWidth` | The reshaped input size of the image.       |
| pixel\_values         | `Tensor`      | The pixel values of the preprocessed image. |

***

### processors\~DetrFeatureExtractorResult : \<code> object \</code>

**Kind**: inner typedef of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Properties**

| Name        | Type     |
| ----------- | -------- |
| pixel\_mask | `Tensor` |

***

### processors\~SamImageProcessorResult : \<code> object \</code>

**Kind**: inner typedef of [`processors`](https://huggingface.co/docs/transformers.js/api/processors#module_processors)\
**Properties**

| Name                   | Type                  |
| ---------------------- | --------------------- |
| pixel\_values          | `Tensor`              |
| original\_sizes        | `Array.<HeightWidth>` |
| reshaped\_input\_sizes | `Array.<HeightWidth>` |
| input\_points          | `Tensor`              |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://boinc-ai.gitbook.io/transformers.js/api-reference/processors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
