use explicit tensor interface

pull/356/head
Vladimir Mandic 2021-05-22 21:54:18 -04:00
parent 9e0318ea52
commit f0739716e2
3 changed files with 6 additions and 4 deletions

View File

@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
### **HEAD -> main** 2021/05/22 mandic00@live.com
- enhance strong typing
- rebuild all for release
### **1.9.2** 2021/05/22 mandic00@live.com

View File

@ -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;

View File

@ -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