mirror of https://github.com/vladmandic/human
use explicit tensor interface
parent
2307767161
commit
76f624f78f
|
@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||||
|
|
||||||
### **HEAD -> main** 2021/05/22 mandic00@live.com
|
### **HEAD -> main** 2021/05/22 mandic00@live.com
|
||||||
|
|
||||||
|
- enhance strong typing
|
||||||
- rebuild all for release
|
- rebuild all for release
|
||||||
|
|
||||||
### **1.9.2** 2021/05/22 mandic00@live.com
|
### **1.9.2** 2021/05/22 mandic00@live.com
|
||||||
|
|
|
@ -6,10 +6,10 @@ import { Tensor, GraphModel } from '../tfjs/types';
|
||||||
export class HandDetector {
|
export class HandDetector {
|
||||||
model: GraphModel;
|
model: GraphModel;
|
||||||
anchors: number[][];
|
anchors: number[][];
|
||||||
anchorsTensor: typeof tf.Tensor;
|
anchorsTensor: Tensor;
|
||||||
inputSize: number;
|
inputSize: number;
|
||||||
inputSizeTensor: typeof tf.Tensor;
|
inputSizeTensor: Tensor;
|
||||||
doubleInputSizeTensor: typeof tf.Tensor;
|
doubleInputSizeTensor: Tensor;
|
||||||
|
|
||||||
constructor(model) {
|
constructor(model) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as tf from '../../dist/tfjs.esm.js';
|
import * as tf from '../../dist/tfjs.esm.js';
|
||||||
import * as fxImage from './imagefx';
|
import * as fxImage from './imagefx';
|
||||||
|
import { Tensor } from '../tfjs/types';
|
||||||
|
|
||||||
const maxSize = 2048;
|
const maxSize = 2048;
|
||||||
// internal temp canvases
|
// internal temp canvases
|
||||||
|
@ -11,7 +12,7 @@ let fx;
|
||||||
// process input image and return tensor
|
// process input image and return tensor
|
||||||
// input can be tensor, imagedata, htmlimageelement, htmlvideoelement
|
// input can be tensor, imagedata, htmlimageelement, htmlvideoelement
|
||||||
// input is resized and run through imagefx filter
|
// 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;
|
let tensor;
|
||||||
if (!input) throw new Error('Human: Input is missing');
|
if (!input) throw new Error('Human: Input is missing');
|
||||||
// sanity checks since different browsers do not implement all dom elements
|
// sanity checks since different browsers do not implement all dom elements
|
||||||
|
|
Loading…
Reference in New Issue