Skip to content

Commit 63f9084

Browse files
committed
docs: use {@link} type references instead of inline value lists in JSDoc
Replace inline enumerations (e.g., `stretch`, `letterbox`, `crop`) with {@link} references to the named types. Expand 'IoU' to 'Intersection over Union (IoU)' for consistency.
1 parent 5118a1d commit 63f9084

9 files changed

Lines changed: 30 additions & 31 deletions

File tree

packages/react-native-executorch/src/extensions/cv/ops/boxes.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ export function decodeBox<F extends BoxFormat>(
7575
* @param opts Options defining dimensions and resize modes.
7676
* @param opts.from The source bounds (e.g. model input dimensions).
7777
* @param opts.to The destination bounds (e.g. original image dimensions).
78-
* @param opts.resizeMode The mode used to resize the image ('letterbox' or
79-
* 'stretch').
78+
* @param opts.resizeMode The mode used to resize the image {@link ResizeMode}
79+
* (excluding `'crop'`).
8080
* @returns The scaled BoundingBox object.
8181
*/
8282
export function scaleBox<F extends BoxFormat>(
@@ -145,9 +145,9 @@ export function scaleBox<F extends BoxFormat>(
145145
* @category Types
146146
*/
147147
export type NmsOptions = {
148-
/** Bounding box format (`xyxy`, `cxcywh`, etc.). */
148+
/** Bounding box format {@link BoxFormat}. */
149149
readonly boxFormat: BoxFormat;
150-
/** IoU threshold for suppressing overlapping boxes. */
150+
/** Intersection over Union (IoU) threshold for suppressing overlapping boxes. */
151151
readonly iouThreshold: number;
152152
/** Minimum confidence score threshold for filtering candidate boxes. */
153153
readonly confidenceThreshold: number;
@@ -165,12 +165,12 @@ export type NmsOptions = {
165165
* @param boxes Bounding boxes coordinate tensor.
166166
* @param scores Bounding boxes confidence scores tensor.
167167
* @param opts Options configuring NMS thresholds and execution mode.
168-
* @param opts.boxFormat Bounding box format (`xyxy`, `cxcywh`, etc.).
168+
* @param opts.boxFormat The bounding box format {@link BoxFormat}.
169169
* @param opts.iouThreshold Intersection over Union (IoU) threshold for
170170
* suppression.
171171
* @param opts.confidenceThreshold Minimum confidence score for candidate
172172
* selection.
173-
* @param opts.nmsType Suppression algorithm mode (`standard` or `weighted`).
173+
* @param opts.nmsType The NMS algorithm variant {@link NmsOptions.nmsType}.
174174
* @returns The resulting indices of the non-suppressed boxes:
175175
* - For `standard` NMS: A 1D array of indices (`number[]`) representing the
176176
* selected boxes.

packages/react-native-executorch/src/extensions/cv/ops/image.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ export type InterpolationMethod = 'nearest' | 'area' | 'cubic' | 'lanczos' | 'li
7474
* @category Types
7575
*/
7676
export type ResizeOptions = {
77-
/** Resize algorithm mode (`stretch`, `letterbox`, `crop`). */
77+
/** Resize algorithm mode {@link ResizeMode}. */
7878
readonly mode?: ResizeMode;
7979
/** Background fill value used when letterboxing. */
8080
readonly padValue?: number;
81-
/** Pixel interpolation method. */
81+
/** Pixel interpolation method {@link InterpolationMethod}. */
8282
readonly interpolation?: InterpolationMethod;
8383
};
8484

@@ -96,18 +96,17 @@ export type NormalizeOptions = {
9696
/**
9797
* Resizes an image tensor from a source dimension to a destination dimension.
9898
*
99-
* Supports various resize modes (`stretch`, `letterbox`, `crop`) and
100-
* interpolation algorithms (`linear`, `lanczos`, etc.).
99+
* Supports various {@link ResizeMode} and {@link InterpolationMethod} options.
101100
* @category Typescript API
102101
* @param src The source image tensor in HWC layout. Shape [H,W,C].
103102
* @param dst The pre-allocated destination tensor to write the resized image
104103
* to. `dst` must be in HWC layout and its number of channels must match `src`.
105104
* Shape [H',W',C].
106105
* @param opts Configuration options for resizing.
107-
* @param opts.mode Resize algorithm mode (`stretch`, `letterbox`, `crop`).
108-
* Defaults to `'stretch'`.
109-
* @param opts.interpolation Pixel interpolation method (`linear`, `lanczos`,
110-
* etc.). Defaults to `'lanczos'`.
106+
* @param opts.mode The resize algorithm mode {@link ResizeMode}. Defaults to
107+
* `'stretch'`.
108+
* @param opts.interpolation The pixel interpolation method
109+
* {@link InterpolationMethod}. Defaults to `'lanczos'`.
111110
* @param opts.padValue Fill value for letterboxing. Defaults to `0`.
112111
* @returns The destination tensor containing the resized image.
113112
*/

packages/react-native-executorch/src/extensions/cv/ops/points.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export type Point = {
1717
* @param opts Options detailing the scaling factors and resize mode.
1818
* @param opts.from The source bounds (e.g. model input dimensions).
1919
* @param opts.to The destination bounds (e.g. original image dimensions).
20-
* @param opts.resizeMode The mode used to resize the image ('letterbox' or
21-
* 'stretch').
20+
* @param opts.resizeMode The mode used to resize the image {@link ResizeMode}
21+
* (excluding `'crop'`).
2222
* @returns The scaled coordinate point.
2323
*/
2424
export function scalePoint(

packages/react-native-executorch/src/extensions/cv/tasks/instanceSegmentation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ export type InstanceSegmenterOptions<F extends BoxFormat, L> = Omit<
3131
ImagePreprocessorOptions,
3232
'resizeMode'
3333
> & {
34-
/** Resize mode for input images. */
34+
/** Resize mode for input images. Must be `'stretch'`. */
3535
readonly resizeMode: 'stretch';
3636
/** Array of class labels matching the model's output vocabulary. */
3737
readonly labels: readonly L[];
38-
/** Bounding box format exported by the model (`xyxy`, `cxcywh`, etc.). */
38+
/** Bounding box format {@link BoxFormat}. */
3939
readonly boxFormat: F;
40-
/** Default IoU threshold for Non-Maximum Suppression (NMS). */
40+
/** Default Intersection over Union (IoU) threshold for Non-Maximum Suppression (NMS). */
4141
readonly defaultIouThreshold: number;
4242
/** Default probability threshold for mask values. */
4343
readonly defaultMaskThreshold: number;
@@ -107,7 +107,7 @@ export async function createInstanceSegmenter<F extends BoxFormat, L>(
107107
* @param options Execution override options.
108108
* @param options.confidenceThreshold Minimum confidence threshold. If
109109
* omitted, uses `modelOpts.defaultConfidenceThreshold`.
110-
* @param options.iouThreshold IoU threshold in NMS. If omitted, uses
110+
* @param options.iouThreshold Intersection over Union (IoU) threshold in NMS. If omitted, uses
111111
* `modelOpts.defaultIouThreshold`.
112112
* @param options.maskThreshold Mask binarization threshold. If omitted,
113113
* uses `modelOpts.defaultMaskThreshold`.

packages/react-native-executorch/src/extensions/cv/tasks/keypointDetection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export type KeypointDetectorOptions<F extends BoxFormat, L extends PropertyKey>
2222
ImagePreprocessorOptions,
2323
'resizeMode'
2424
> & {
25-
/** Resize mode for preprocessing input images (`stretch` or `letterbox`). */
25+
/** Resize mode for preprocessing input images {@link ResizeMode} (excluding `'crop'`). */
2626
readonly resizeMode: Exclude<ResizeMode, 'crop'>;
27-
/** Bounding box format exported by the model (`xyxy`, `cxcywh`, etc.). */
27+
/** Bounding box format {@link BoxFormat}. */
2828
readonly boxFormat: F;
2929
/** Array of landmark names matching the model output keypoint locations. */
3030
readonly landmarks: readonly L[];
31-
/** Default IoU threshold for Non-Maximum Suppression (NMS). */
31+
/** Default Intersection over Union (IoU) threshold for Non-Maximum Suppression (NMS). */
3232
readonly defaultIouThreshold: number;
3333
/** Default minimum confidence score threshold for keypoint detections. */
3434
readonly defaultConfidenceThreshold: number;

packages/react-native-executorch/src/extensions/cv/tasks/objectDetection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export type ObjectDetectorOptions<F extends BoxFormat, L> = Omit<
2121
ImagePreprocessorOptions,
2222
'resizeMode'
2323
> & {
24-
/** Resize mode for preprocessing input images (`stretch` or `letterbox`). */
24+
/** Resize mode for preprocessing input images {@link ResizeMode} (excluding `'crop'`). */
2525
readonly resizeMode: Exclude<ResizeMode, 'crop'>;
2626
/** Array of class labels matching the model's output vocabulary. */
2727
readonly labels: readonly L[];
28-
/** Bounding box format exported by the model (`xyxy`, `cxcywh`, etc.). */
28+
/** Bounding box format {@link BoxFormat}. */
2929
readonly boxFormat: F;
30-
/** Default IoU threshold for Non-Maximum Suppression (NMS). */
30+
/** Default Intersection over Union (IoU) threshold for Non-Maximum Suppression (NMS). */
3131
readonly defaultIouThreshold: number;
3232
/** Default minimum confidence score threshold for detections. */
3333
readonly defaultConfidenceThreshold: number;
@@ -86,7 +86,7 @@ export async function createObjectDetector<F extends BoxFormat, L>(
8686
* @param options Configuration options for object detection.
8787
* @param options.confidenceThreshold Minimum confidence score threshold. If
8888
* omitted, uses `modelOpts.defaultConfidenceThreshold`.
89-
* @param options.iouThreshold Non-maximum suppression IoU threshold. If
89+
* @param options.iouThreshold Intersection over Union (IoU) threshold. If
9090
* omitted, uses `modelOpts.defaultIouThreshold`.
9191
* @returns A promise resolving to the list of object detections.
9292
*/

packages/react-native-executorch/src/extensions/cv/tasks/preprocessing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import {
1919
* @category Types
2020
*/
2121
export type ImagePreprocessorOptions = {
22-
/** Resize algorithm mode (`stretch`, `letterbox`, `crop`). */
22+
/** Resize algorithm mode {@link ResizeMode}. */
2323
readonly resizeMode: ResizeMode;
24-
/** Pixel interpolation method (`linear`, `lanczos`, etc.). */
24+
/** Pixel interpolation method {@link InterpolationMethod}. */
2525
readonly interpolation: InterpolationMethod;
2626
/** Normalization scaling coefficients. */
2727
readonly normalizeOpts: NormalizeOptions;

packages/react-native-executorch/src/extensions/cv/tasks/semanticSegmentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { sigmoid, argmax } from '../../math';
2323
* @category Types
2424
*/
2525
export type SemanticSegmenterOptions<L> = Omit<ImagePreprocessorOptions, 'resizeMode'> & {
26-
/** Resize mode for input images. */
26+
/** Resize mode for input images. Must be `'stretch'`. */
2727
readonly resizeMode: 'stretch';
2828
/** Interpolation method used when resizing output masks back to input image dimensions. */
2929
readonly outInterpolation: InterpolationMethod;

packages/react-native-executorch/src/extensions/speech/utils/vadUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { type Tensor } from '../../../core/tensor';
88
export type ExtractFramesOptions = {
99
/** Number of audio frames to extract and write into the destination tensor. */
1010
readonly numFrames: number;
11-
/** Samples between consecutive frames. */
11+
/** Number of samples between consecutive frames. */
1212
readonly hopLength: number;
1313
/** Pre-emphasis filter coefficient. */
1414
readonly preemphasis: number;

0 commit comments

Comments
 (0)