Re-use classifier options for ObjectDetector
PiperOrigin-RevId: 492206856
This commit is contained in:
parent
3ee37800e2
commit
e685ac9344
|
@ -36,6 +36,7 @@ export function computeCosineSimilarity(u: Embedding, v: Embedding): number {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Cannot compute cosine similarity between quantized and float embeddings.');
|
'Cannot compute cosine similarity between quantized and float embeddings.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertToBytes(data: Uint8Array): number[] {
|
function convertToBytes(data: Uint8Array): number[] {
|
||||||
return Array.from(data, v => v - 128);
|
return Array.from(data, v => v - 128);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ mediapipe_ts_declaration(
|
||||||
deps = [
|
deps = [
|
||||||
"//mediapipe/tasks/web/components/containers:category",
|
"//mediapipe/tasks/web/components/containers:category",
|
||||||
"//mediapipe/tasks/web/core",
|
"//mediapipe/tasks/web/core",
|
||||||
|
"//mediapipe/tasks/web/core:classifier_options",
|
||||||
"//mediapipe/tasks/web/vision/core:vision_task_options",
|
"//mediapipe/tasks/web/vision/core:vision_task_options",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,36 +14,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {ClassifierOptions} from '../../../../tasks/web/core/classifier_options';
|
||||||
import {VisionTaskOptions} from '../../../../tasks/web/vision/core/vision_task_options';
|
import {VisionTaskOptions} from '../../../../tasks/web/vision/core/vision_task_options';
|
||||||
|
|
||||||
/** Options to configure the MediaPipe Object Detector Task */
|
/** Options to configure the MediaPipe Object Detector Task */
|
||||||
export interface ObjectDetectorOptions extends VisionTaskOptions {
|
export interface ObjectDetectorOptions extends VisionTaskOptions,
|
||||||
/**
|
ClassifierOptions {}
|
||||||
* The locale to use for display names specified through the TFLite Model
|
|
||||||
* Metadata, if any. Defaults to English.
|
|
||||||
*/
|
|
||||||
displayNamesLocale?: string|undefined;
|
|
||||||
|
|
||||||
/** The maximum number of top-scored detection results to return. */
|
|
||||||
maxResults?: number|undefined;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overrides the value provided in the model metadata. Results below this
|
|
||||||
* value are rejected.
|
|
||||||
*/
|
|
||||||
scoreThreshold?: number|undefined;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allowlist of category names. If non-empty, detection results whose category
|
|
||||||
* name is not in this set will be filtered out. Duplicate or unknown category
|
|
||||||
* names are ignored. Mutually exclusive with `categoryDenylist`.
|
|
||||||
*/
|
|
||||||
categoryAllowlist?: string[]|undefined;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Denylist of category names. If non-empty, detection results whose category
|
|
||||||
* name is in this set will be filtered out. Duplicate or unknown category
|
|
||||||
* names are ignored. Mutually exclusive with `categoryAllowlist`.
|
|
||||||
*/
|
|
||||||
categoryDenylist?: string[]|undefined;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user