From 5aeb449a67173e5223ae7bf23bde17b36c10bfad Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sat, 22 May 2021 21:54:18 -0400 Subject: [PATCH] use explicit tensor interface --- CHANGELOG.md | 1 + src/handpose/handdetector.ts | 6 +++--- src/image/image.ts | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96e7b158..f35f05b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Repository: **** ### **HEAD -> main** 2021/05/22 mandic00@live.com +- enhance strong typing - rebuild all for release ### **1.9.2** 2021/05/22 mandic00@live.com diff --git a/src/handpose/handdetector.ts b/src/handpose/handdetector.ts index 94f534cb..3ceed6d6 100644 --- a/src/handpose/handdetector.ts +++ b/src/handpose/handdetector.ts @@ -6,10 +6,10 @@ import { Tensor, GraphModel } from '../tfjs/types'; export class HandDetector { model: GraphModel; anchors: number[][]; - anchorsTensor: typeof tf.Tensor; + anchorsTensor: Tensor; inputSize: number; - inputSizeTensor: typeof tf.Tensor; - doubleInputSizeTensor: typeof tf.Tensor; + inputSizeTensor: Tensor; + doubleInputSizeTensor: Tensor; constructor(model) { this.model = model; diff --git a/src/image/image.ts b/src/image/image.ts index 1e2d03b3..167e8653 100644 --- a/src/image/image.ts +++ b/src/image/image.ts @@ -1,5 +1,6 @@ import * as tf from '../../dist/tfjs.esm.js'; import * as fxImage from './imagefx'; +import { Tensor } from '../tfjs/types'; const maxSize = 2048; // internal temp canvases @@ -11,7 +12,7 @@ let fx; // process input image and return tensor // input can be tensor, imagedata, htmlimageelement, htmlvideoelement // input is resized and run through imagefx filter -export function process(input, config): { tensor: typeof tf.Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } { +export function process(input, config): { tensor: Tensor | null, canvas: OffscreenCanvas | HTMLCanvasElement } { let tensor; if (!input) throw new Error('Human: Input is missing'); // sanity checks since different browsers do not implement all dom elements