Skip to content

Commit c9a1e5f

Browse files
Merge pull request justadudewhohacks#23 from justadudewhohacks/await-media-loaded
Await media loaded
2 parents b9ca0b9 + 26c7fb4 commit c9a1e5f

Some content is hidden

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

63 files changed

+1219
-699
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ faceapi.drawDetection(canvas, detectionsForSize, { withScore: false })
171171
You can also obtain the tensors of the unfiltered bounding boxes and scores for each image in the batch (tensors have to be disposed manually):
172172

173173
``` javascript
174-
const { boxes, scores } = net.forward('myImg')
174+
const { boxes, scores } = await net.forward('myImg')
175175
```
176176

177177
<a name="usage-face-recognition"></a>
@@ -195,7 +195,7 @@ else
195195
Or simply obtain the tensor (tensor has to be disposed manually):
196196

197197
``` javascript
198-
const t = net.forward('myImg')
198+
const t = await net.forward('myImg')
199199
```
200200

201201
<a name="usage-face-landmark-detection"></a>

build/NetInput.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Dimensions, TNetInput } from './types';
1+
import { Dimensions, TMediaElement } from './types';
22
export declare class NetInput {
33
private _canvases;
4-
constructor(mediaArg: TNetInput, dims?: Dimensions);
4+
constructor(medias: Array<TMediaElement>, dims?: Dimensions);
55
private initCanvas(media, dims?);
66
readonly canvases: HTMLCanvasElement[];
77
readonly width: number;

build/NetInput.js

Lines changed: 1 addition & 17 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.js

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.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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as tf from '@tensorflow/tfjs-core';
2+
import { NetInput } from '../NetInput';
3+
export declare function getImageTensor(input: tf.Tensor | NetInput): tf.Tensor4D;

build/commons/getImageTensor.js

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

build/commons/getImageTensor.js.map

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

build/drawing/index.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { FaceDetection } from '../faceDetectionNet/FaceDetection';
2+
import { FaceLandmarks } from '../faceLandmarkNet/FaceLandmarks';
3+
import { DrawBoxOptions, DrawLandmarksOptions, DrawOptions, DrawTextOptions } from './types';
4+
export declare function getDefaultDrawOptions(): DrawOptions;
5+
export declare function drawBox(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, options: DrawBoxOptions): void;
6+
export declare function drawText(ctx: CanvasRenderingContext2D, x: number, y: number, text: string, options: DrawTextOptions): void;
7+
export declare function drawDetection(canvasArg: string | HTMLCanvasElement, detection: FaceDetection | FaceDetection[], options?: DrawBoxOptions & DrawTextOptions & {
8+
withScore: boolean;
9+
}): void;
10+
export declare function drawLandmarks(canvasArg: string | HTMLCanvasElement, faceLandmarks: FaceLandmarks | FaceLandmarks[], options?: DrawLandmarksOptions & {
11+
drawLines: boolean;
12+
}): void;

0 commit comments

Comments
 (0)