Skip to content

Commit d2e2d36

Browse files
Merge pull request justadudewhohacks#35 from justadudewhohacks/batch-input
added general handling of batch inputs + face landmark net accepts batch inputs now
2 parents b8d6259 + 200f62a commit d2e2d36

File tree

89 files changed

+1682
-1002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1682
-1002
lines changed

build/NetInput.d.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
import { Dimensions, TMediaElement } from './types';
1+
import * as tf from '@tensorflow/tfjs-core';
2+
import { Point } from './Point';
3+
import { TResolvedNetInput } from './types';
24
export declare class NetInput {
3-
private _canvases;
4-
constructor(medias: Array<TMediaElement>, dims?: Dimensions);
5-
private initCanvas(media, dims?);
6-
readonly canvases: HTMLCanvasElement[];
7-
readonly width: number;
8-
readonly height: number;
9-
readonly dims: Dimensions | null;
5+
private _inputs;
6+
private _isManaged;
7+
private _isBatchInput;
8+
private _inputDimensions;
9+
private _paddings;
10+
constructor(inputs: tf.Tensor4D | Array<TResolvedNetInput>, isBatchInput?: boolean);
11+
readonly inputs: tf.Tensor3D[];
12+
readonly isManaged: boolean;
13+
readonly isBatchInput: boolean;
14+
readonly batchSize: number;
15+
readonly inputDimensions: number[][];
16+
readonly paddings: Point[];
17+
getInputDimensions(batchIdx: number): number[];
18+
getInputHeight(batchIdx: number): number;
19+
getInputWidth(batchIdx: number): number;
20+
getPaddings(batchIdx: number): Point;
21+
toBatchTensor(inputSize: number, isCenterInputs?: boolean): tf.Tensor4D;
22+
/**
23+
* By setting the isManaged flag, all newly created tensors will be automatically
24+
* automatically disposed after the batch tensor has been created
25+
*/
26+
managed(): this;
27+
dispose(): void;
1028
}

build/NetInput.js

Lines changed: 92 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/NetInput.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/allFacesFactory.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import * as tf from '@tensorflow/tfjs-core';
21
import { FaceDetectionNet } from './faceDetectionNet/FaceDetectionNet';
32
import { FaceLandmarkNet } from './faceLandmarkNet/FaceLandmarkNet';
43
import { FaceRecognitionNet } from './faceRecognitionNet/FaceRecognitionNet';
54
import { FullFaceDescription } from './FullFaceDescription';
6-
import { NetInput } from './NetInput';
7-
export declare function allFacesFactory(detectionNet: FaceDetectionNet, landmarkNet: FaceLandmarkNet, recognitionNet: FaceRecognitionNet): (input: string | HTMLCanvasElement | HTMLImageElement | HTMLVideoElement | (string | HTMLCanvasElement | HTMLImageElement | HTMLVideoElement)[] | tf.Tensor<tf.Rank> | NetInput, minConfidence: number) => Promise<FullFaceDescription[]>;
5+
import { TNetInput } from './types';
6+
export declare function allFacesFactory(detectionNet: FaceDetectionNet, landmarkNet: FaceLandmarkNet, recognitionNet: FaceRecognitionNet): (input: TNetInput, minConfidence: number) => Promise<FullFaceDescription[]>;

build/allFacesFactory.js

Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/allFacesFactory.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/commons/getImageTensor.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

build/commons/getImageTensor.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

build/commons/getImageTensor.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/commons/isMediaElement.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export declare function isMediaElement(input: any): boolean;

0 commit comments

Comments
 (0)