parent
461e074993
commit
d78dd3aae1
|
@ -1,4 +1,4 @@
|
|||
# packageJson
|
||||
#
|
||||
|
||||
Version: **undefined**
|
||||
Description: **undefined**
|
||||
|
@ -9,8 +9,13 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> master** 2021/09/29 mandic00@live.com
|
||||
### **1.5.5** 2021/10/19 mandic00@live.com
|
||||
|
||||
|
||||
### **origin/master** 2021/09/30 mandic00@live.com
|
||||
|
||||
- allow backend change in demo via url params
|
||||
- add node-match demo
|
||||
- fix face matcher
|
||||
|
||||
### **1.5.4** 2021/09/29 mandic00@live.com
|
||||
|
|
|
@ -539,9 +539,8 @@ function normalize(x, meanRgb) {
|
|||
function padToSquare(imgTensor, isCenterImage = false) {
|
||||
return tfjs_esm_exports.tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
if (height === width) {
|
||||
if (height === width)
|
||||
return imgTensor;
|
||||
}
|
||||
const dimDiff = Math.abs(height - width);
|
||||
const paddingAmount = Math.round(dimDiff * (isCenterImage ? 0.5 : 1));
|
||||
const paddingAxis = height > width ? 2 : 1;
|
||||
|
@ -553,11 +552,7 @@ function padToSquare(imgTensor, isCenterImage = false) {
|
|||
const paddingTensorAppend = createPaddingTensor(paddingAmount);
|
||||
const remainingPaddingAmount = dimDiff - paddingTensorAppend.shape[paddingAxis];
|
||||
const paddingTensorPrepend = isCenterImage && remainingPaddingAmount ? createPaddingTensor(remainingPaddingAmount) : null;
|
||||
const tensorsToStack = [
|
||||
paddingTensorPrepend,
|
||||
imgTensor,
|
||||
paddingTensorAppend
|
||||
].filter((t) => !!t).map((t) => tfjs_esm_exports.cast(t, "float32"));
|
||||
const tensorsToStack = [paddingTensorPrepend, imgTensor, paddingTensorAppend].filter((t) => !!t).map((t) => tfjs_esm_exports.cast(t, "float32"));
|
||||
return tfjs_esm_exports.concat(tensorsToStack, paddingAxis);
|
||||
});
|
||||
}
|
||||
|
@ -2152,7 +2147,7 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version10 = "1.5.4";
|
||||
var version10 = "1.5.5";
|
||||
|
||||
// src/xception/extractParams.ts
|
||||
function extractorsFactory2(extractWeights, paramMappings) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -60600,9 +60600,8 @@ function normalize(x, meanRgb) {
|
|||
function padToSquare(imgTensor, isCenterImage = false) {
|
||||
return tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
if (height === width) {
|
||||
if (height === width)
|
||||
return imgTensor;
|
||||
}
|
||||
const dimDiff = Math.abs(height - width);
|
||||
const paddingAmount = Math.round(dimDiff * (isCenterImage ? 0.5 : 1));
|
||||
const paddingAxis = height > width ? 2 : 1;
|
||||
|
@ -60614,11 +60613,7 @@ function padToSquare(imgTensor, isCenterImage = false) {
|
|||
const paddingTensorAppend = createPaddingTensor(paddingAmount);
|
||||
const remainingPaddingAmount = dimDiff - paddingTensorAppend.shape[paddingAxis];
|
||||
const paddingTensorPrepend = isCenterImage && remainingPaddingAmount ? createPaddingTensor(remainingPaddingAmount) : null;
|
||||
const tensorsToStack = [
|
||||
paddingTensorPrepend,
|
||||
imgTensor,
|
||||
paddingTensorAppend
|
||||
].filter((t) => !!t).map((t) => cast(t, "float32"));
|
||||
const tensorsToStack = [paddingTensorPrepend, imgTensor, paddingTensorAppend].filter((t) => !!t).map((t) => cast(t, "float32"));
|
||||
return concat(tensorsToStack, paddingAxis);
|
||||
});
|
||||
}
|
||||
|
@ -62213,7 +62208,7 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version6 = "1.5.4";
|
||||
var version6 = "1.5.5";
|
||||
|
||||
// src/xception/extractParams.ts
|
||||
function extractorsFactory2(extractWeights, paramMappings) {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -665,9 +665,8 @@ var tf3 = __toModule(require_tfjs_esm());
|
|||
function padToSquare(imgTensor, isCenterImage = false) {
|
||||
return tf3.tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
if (height === width) {
|
||||
if (height === width)
|
||||
return imgTensor;
|
||||
}
|
||||
const dimDiff = Math.abs(height - width);
|
||||
const paddingAmount = Math.round(dimDiff * (isCenterImage ? 0.5 : 1));
|
||||
const paddingAxis = height > width ? 2 : 1;
|
||||
|
@ -679,11 +678,7 @@ function padToSquare(imgTensor, isCenterImage = false) {
|
|||
const paddingTensorAppend = createPaddingTensor(paddingAmount);
|
||||
const remainingPaddingAmount = dimDiff - paddingTensorAppend.shape[paddingAxis];
|
||||
const paddingTensorPrepend = isCenterImage && remainingPaddingAmount ? createPaddingTensor(remainingPaddingAmount) : null;
|
||||
const tensorsToStack = [
|
||||
paddingTensorPrepend,
|
||||
imgTensor,
|
||||
paddingTensorAppend
|
||||
].filter((t) => !!t).map((t) => tf3.cast(t, "float32"));
|
||||
const tensorsToStack = [paddingTensorPrepend, imgTensor, paddingTensorAppend].filter((t) => !!t).map((t) => tf3.cast(t, "float32"));
|
||||
return tf3.concat(tensorsToStack, paddingAxis);
|
||||
});
|
||||
}
|
||||
|
@ -2307,7 +2302,7 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version = "1.5.4";
|
||||
var version = "1.5.5";
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var tf20 = __toModule(require_tfjs_esm());
|
||||
|
|
|
@ -665,9 +665,8 @@ var tf3 = __toModule(require_tfjs_esm());
|
|||
function padToSquare(imgTensor, isCenterImage = false) {
|
||||
return tf3.tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
if (height === width) {
|
||||
if (height === width)
|
||||
return imgTensor;
|
||||
}
|
||||
const dimDiff = Math.abs(height - width);
|
||||
const paddingAmount = Math.round(dimDiff * (isCenterImage ? 0.5 : 1));
|
||||
const paddingAxis = height > width ? 2 : 1;
|
||||
|
@ -679,11 +678,7 @@ function padToSquare(imgTensor, isCenterImage = false) {
|
|||
const paddingTensorAppend = createPaddingTensor(paddingAmount);
|
||||
const remainingPaddingAmount = dimDiff - paddingTensorAppend.shape[paddingAxis];
|
||||
const paddingTensorPrepend = isCenterImage && remainingPaddingAmount ? createPaddingTensor(remainingPaddingAmount) : null;
|
||||
const tensorsToStack = [
|
||||
paddingTensorPrepend,
|
||||
imgTensor,
|
||||
paddingTensorAppend
|
||||
].filter((t) => !!t).map((t) => tf3.cast(t, "float32"));
|
||||
const tensorsToStack = [paddingTensorPrepend, imgTensor, paddingTensorAppend].filter((t) => !!t).map((t) => tf3.cast(t, "float32"));
|
||||
return tf3.concat(tensorsToStack, paddingAxis);
|
||||
});
|
||||
}
|
||||
|
@ -2307,7 +2302,7 @@ function drawFaceLandmarks(canvasArg, faceLandmarks) {
|
|||
}
|
||||
|
||||
// package.json
|
||||
var version = "1.5.4";
|
||||
var version = "1.5.5";
|
||||
|
||||
// src/ageGenderNet/AgeGenderNet.ts
|
||||
var tf20 = __toModule(require_tfjs_esm());
|
||||
|
|
18
package.json
18
package.json
|
@ -52,18 +52,18 @@
|
|||
"@tensorflow/tfjs-layers": "^3.9.0",
|
||||
"@tensorflow/tfjs-node": "^3.9.0",
|
||||
"@tensorflow/tfjs-node-gpu": "^3.9.0",
|
||||
"@types/node": "^16.10.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.32.0",
|
||||
"@typescript-eslint/parser": "^4.32.0",
|
||||
"@vladmandic/build": "^0.5.3",
|
||||
"@types/node": "^16.11.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
||||
"@typescript-eslint/parser": "^5.1.0",
|
||||
"@vladmandic/build": "^0.6.1",
|
||||
"@vladmandic/pilogger": "^0.3.3",
|
||||
"canvas": "^2.8.0",
|
||||
"chokidar": "^3.5.2",
|
||||
"dayjs": "^1.10.7",
|
||||
"esbuild": "^0.13.3",
|
||||
"eslint": "^7.32.0",
|
||||
"esbuild": "^0.13.8",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-import": "^2.25.2",
|
||||
"eslint-plugin-json": "^3.1.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
|
@ -72,7 +72,7 @@
|
|||
"seedrandom": "^3.0.5",
|
||||
"simple-git": "^2.46.0",
|
||||
"tslib": "^2.3.1",
|
||||
"typedoc": "^0.22.4",
|
||||
"typescript": "4.4.3"
|
||||
"typedoc": "^0.22.6",
|
||||
"typescript": "4.4.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ export abstract class NeuralNetwork<TNetParams> {
|
|||
this._name = name;
|
||||
}
|
||||
|
||||
protected _params: TNetParams | undefined = undefined
|
||||
protected _params: TNetParams | undefined = undefined;
|
||||
|
||||
protected _paramMappings: ParamMapping[] = []
|
||||
protected _paramMappings: ParamMapping[] = [];
|
||||
|
||||
public _name: any;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { NeuralNetwork } from '../NeuralNetwork';
|
|||
import { NetInput, TNetInput, toNetInput } from '../dom/index';
|
||||
|
||||
export class AgeGenderNet extends NeuralNetwork<NetParams> {
|
||||
private _faceFeatureExtractor: TinyXception
|
||||
private _faceFeatureExtractor: TinyXception;
|
||||
|
||||
constructor(faceFeatureExtractor: TinyXception = new TinyXception(2)) {
|
||||
super('AgeGenderNet');
|
||||
|
|
|
@ -19,13 +19,13 @@ export class Box<BoxType = any> implements IBoundingBox, IRect {
|
|||
}
|
||||
}
|
||||
|
||||
private _x: number
|
||||
private _x: number;
|
||||
|
||||
private _y: number
|
||||
private _y: number;
|
||||
|
||||
private _width: number
|
||||
private _width: number;
|
||||
|
||||
private _height: number
|
||||
private _height: number;
|
||||
|
||||
constructor(_box: IBoundingBox | IRect, allowNegativeDimensions = true) {
|
||||
const box = (_box || {}) as any;
|
||||
|
|
|
@ -6,9 +6,9 @@ export interface IDimensions {
|
|||
}
|
||||
|
||||
export class Dimensions implements IDimensions {
|
||||
private _width: number
|
||||
private _width: number;
|
||||
|
||||
private _height: number
|
||||
private _height: number;
|
||||
|
||||
constructor(width: number, height: number) {
|
||||
if (!isValidNumber(width) || !isValidNumber(height)) {
|
||||
|
|
|
@ -18,11 +18,11 @@ export interface IFaceLandmarks {
|
|||
}
|
||||
|
||||
export class FaceLandmarks implements IFaceLandmarks {
|
||||
protected _shift: Point
|
||||
protected _shift: Point;
|
||||
|
||||
protected _positions: Point[]
|
||||
protected _positions: Point[];
|
||||
|
||||
protected _imgDims: Dimensions
|
||||
protected _imgDims: Dimensions;
|
||||
|
||||
constructor(
|
||||
relativeFaceLandmarkPositions: Point[],
|
||||
|
|
|
@ -6,8 +6,8 @@ export interface IFaceMatch {
|
|||
}
|
||||
|
||||
export class FaceMatch implements IFaceMatch {
|
||||
private _label: string
|
||||
private _distance: number
|
||||
private _label: string;
|
||||
private _distance: number;
|
||||
|
||||
constructor(label: string, distance: number) {
|
||||
this._label = label;
|
||||
|
|
|
@ -12,7 +12,7 @@ export class LabeledBox extends Box<LabeledBox> {
|
|||
}
|
||||
}
|
||||
|
||||
private _label: number
|
||||
private _label: number;
|
||||
|
||||
constructor(box: IBoundingBox | IRect | any, label: number) {
|
||||
super(box);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
export class LabeledFaceDescriptors {
|
||||
private _label: string
|
||||
private _label: string;
|
||||
|
||||
private _descriptors: Float32Array[]
|
||||
private _descriptors: Float32Array[];
|
||||
|
||||
constructor(label: string, descriptors: Float32Array[]) {
|
||||
if (!(typeof label === 'string')) {
|
||||
|
|
|
@ -3,15 +3,15 @@ import { Dimensions, IDimensions } from './Dimensions';
|
|||
import { IRect, Rect } from './Rect';
|
||||
|
||||
export class ObjectDetection {
|
||||
private _score: number
|
||||
private _score: number;
|
||||
|
||||
private _classScore: number
|
||||
private _classScore: number;
|
||||
|
||||
private _className: string
|
||||
private _className: string;
|
||||
|
||||
private _box: Rect
|
||||
private _box: Rect;
|
||||
|
||||
private _imageDims: Dimensions
|
||||
private _imageDims: Dimensions;
|
||||
|
||||
constructor(
|
||||
score: number,
|
||||
|
|
|
@ -4,9 +4,9 @@ export interface IPoint {
|
|||
}
|
||||
|
||||
export class Point implements IPoint {
|
||||
private _x: number
|
||||
private _x: number;
|
||||
|
||||
private _y: number
|
||||
private _y: number;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
this._x = x;
|
||||
|
|
|
@ -15,9 +15,9 @@ export class PredictedBox extends LabeledBox {
|
|||
}
|
||||
}
|
||||
|
||||
private _score: number
|
||||
private _score: number;
|
||||
|
||||
private _classScore: number
|
||||
private _classScore: number;
|
||||
|
||||
constructor(box: IBoundingBox | IRect | any, label: number, score: number, classScore: number) {
|
||||
super(box, label);
|
||||
|
|
|
@ -9,17 +9,17 @@ import { imageToSquare } from './imageToSquare';
|
|||
import { TResolvedNetInput } from './types';
|
||||
|
||||
export class NetInput {
|
||||
private _imageTensors: Array<tf.Tensor3D | tf.Tensor4D> = []
|
||||
private _imageTensors: Array<tf.Tensor3D | tf.Tensor4D> = [];
|
||||
|
||||
private _canvases: HTMLCanvasElement[] = []
|
||||
private _canvases: HTMLCanvasElement[] = [];
|
||||
|
||||
private _batchSize: number
|
||||
private _batchSize: number;
|
||||
|
||||
private _treatAsBatchInput = false
|
||||
private _treatAsBatchInput = false;
|
||||
|
||||
private _inputDimensions: number[][] = []
|
||||
private _inputDimensions: number[][] = [];
|
||||
|
||||
private _inputSize = 0
|
||||
private _inputSize = 0;
|
||||
|
||||
constructor(inputs: Array<TResolvedNetInput>, treatAsBatchInput = false) {
|
||||
if (!Array.isArray(inputs)) {
|
||||
|
|
|
@ -11,13 +11,13 @@ export interface IDrawBoxOptions {
|
|||
}
|
||||
|
||||
export class DrawBoxOptions {
|
||||
public boxColor: string
|
||||
public boxColor: string;
|
||||
|
||||
public lineWidth: number
|
||||
public lineWidth: number;
|
||||
|
||||
public drawLabelOptions: DrawTextFieldOptions
|
||||
public drawLabelOptions: DrawTextFieldOptions;
|
||||
|
||||
public label?: string
|
||||
public label?: string;
|
||||
|
||||
constructor(options: IDrawBoxOptions = {}) {
|
||||
const {
|
||||
|
@ -36,9 +36,9 @@ export class DrawBoxOptions {
|
|||
}
|
||||
|
||||
export class DrawBox {
|
||||
public box: Box
|
||||
public box: Box;
|
||||
|
||||
public options: DrawBoxOptions
|
||||
public options: DrawBoxOptions;
|
||||
|
||||
constructor(
|
||||
box: IBoundingBox | IRect,
|
||||
|
|
|
@ -17,17 +17,17 @@ export interface IDrawFaceLandmarksOptions {
|
|||
}
|
||||
|
||||
export class DrawFaceLandmarksOptions {
|
||||
public drawLines: boolean
|
||||
public drawLines: boolean;
|
||||
|
||||
public drawPoints: boolean
|
||||
public drawPoints: boolean;
|
||||
|
||||
public lineWidth: number
|
||||
public lineWidth: number;
|
||||
|
||||
public pointSize: number
|
||||
public pointSize: number;
|
||||
|
||||
public lineColor: string
|
||||
public lineColor: string;
|
||||
|
||||
public pointColor: string
|
||||
public pointColor: string;
|
||||
|
||||
constructor(options: IDrawFaceLandmarksOptions = {}) {
|
||||
const {
|
||||
|
@ -43,9 +43,9 @@ export class DrawFaceLandmarksOptions {
|
|||
}
|
||||
|
||||
export class DrawFaceLandmarks {
|
||||
public faceLandmarks: FaceLandmarks
|
||||
public faceLandmarks: FaceLandmarks;
|
||||
|
||||
public options: DrawFaceLandmarksOptions
|
||||
public options: DrawFaceLandmarksOptions;
|
||||
|
||||
constructor(
|
||||
faceLandmarks: FaceLandmarks,
|
||||
|
|
|
@ -25,17 +25,17 @@ export interface IDrawTextFieldOptions {
|
|||
}
|
||||
|
||||
export class DrawTextFieldOptions implements IDrawTextFieldOptions {
|
||||
public anchorPosition: AnchorPosition
|
||||
public anchorPosition: AnchorPosition;
|
||||
|
||||
public backgroundColor: string
|
||||
public backgroundColor: string;
|
||||
|
||||
public fontColor: string
|
||||
public fontColor: string;
|
||||
|
||||
public fontSize: number
|
||||
public fontSize: number;
|
||||
|
||||
public fontStyle: string
|
||||
public fontStyle: string;
|
||||
|
||||
public padding: number
|
||||
public padding: number;
|
||||
|
||||
constructor(options: IDrawTextFieldOptions = {}) {
|
||||
const {
|
||||
|
@ -51,11 +51,11 @@ export class DrawTextFieldOptions implements IDrawTextFieldOptions {
|
|||
}
|
||||
|
||||
export class DrawTextField {
|
||||
public text: string[]
|
||||
public text: string[];
|
||||
|
||||
public anchor : IPoint
|
||||
public anchor : IPoint;
|
||||
|
||||
public options: DrawTextFieldOptions
|
||||
public options: DrawTextFieldOptions;
|
||||
|
||||
constructor(
|
||||
text: string | string[] | DrawTextField,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
export const FACE_EXPRESSION_LABELS = ['neutral', 'happy', 'sad', 'angry', 'fearful', 'disgusted', 'surprised'];
|
||||
|
||||
export class FaceExpressions {
|
||||
public neutral = 0
|
||||
public happy = 0
|
||||
public sad = 0
|
||||
public angry = 0
|
||||
public fearful = 0
|
||||
public disgusted = 0
|
||||
public surprised = 0
|
||||
public neutral = 0;
|
||||
public happy = 0;
|
||||
public sad = 0;
|
||||
public angry = 0;
|
||||
public fearful = 0;
|
||||
public disgusted = 0;
|
||||
public surprised = 0;
|
||||
|
||||
constructor(probabilities: number[] | Float32Array) {
|
||||
if (probabilities.length !== 7) {
|
||||
|
|
|
@ -13,7 +13,7 @@ export abstract class FaceProcessor<
|
|||
TExtractorParams extends FaceFeatureExtractorParams | TinyFaceFeatureExtractorParams
|
||||
>
|
||||
extends NeuralNetwork<NetParams> {
|
||||
protected _faceFeatureExtractor: IFaceFeatureExtractor<TExtractorParams>
|
||||
protected _faceFeatureExtractor: IFaceFeatureExtractor<TExtractorParams>;
|
||||
|
||||
constructor(_name: string, faceFeatureExtractor: IFaceFeatureExtractor<TExtractorParams>) {
|
||||
super(_name);
|
||||
|
|
|
@ -4,8 +4,8 @@ import { euclideanDistance } from '../euclideanDistance';
|
|||
import { WithFaceDescriptor } from '../factories/index';
|
||||
|
||||
export class FaceMatcher {
|
||||
private _labeledDescriptors: LabeledFaceDescriptors[]
|
||||
private _distanceThreshold: number
|
||||
private _labeledDescriptors: LabeledFaceDescriptors[];
|
||||
private _distanceThreshold: number;
|
||||
|
||||
constructor(inputs: LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array>, distanceThreshold = 0.6) {
|
||||
this._distanceThreshold = distanceThreshold;
|
||||
|
|
|
@ -8,38 +8,22 @@ import * as tf from '../../dist/tfjs.esm';
|
|||
* both sides of the minor dimension oof the image.
|
||||
* @returns The padded tensor with width === height.
|
||||
*/
|
||||
export function padToSquare(
|
||||
imgTensor: tf.Tensor4D,
|
||||
isCenterImage = false,
|
||||
): tf.Tensor4D {
|
||||
export function padToSquare(imgTensor: tf.Tensor4D, isCenterImage = false): tf.Tensor4D {
|
||||
return tf.tidy(() => {
|
||||
const [height, width] = imgTensor.shape.slice(1);
|
||||
if (height === width) {
|
||||
return imgTensor;
|
||||
}
|
||||
|
||||
if (height === width) return imgTensor;
|
||||
const dimDiff = Math.abs(height - width);
|
||||
const paddingAmount = Math.round(dimDiff * (isCenterImage ? 0.5 : 1));
|
||||
const paddingAxis = height > width ? 2 : 1;
|
||||
|
||||
const createPaddingTensor = (paddingAmountLocal: number): tf.Tensor => {
|
||||
const paddingTensorShape = imgTensor.shape.slice();
|
||||
paddingTensorShape[paddingAxis] = paddingAmountLocal;
|
||||
return tf.fill(paddingTensorShape, 0, 'float32');
|
||||
};
|
||||
|
||||
const paddingTensorAppend = createPaddingTensor(paddingAmount);
|
||||
const remainingPaddingAmount = dimDiff - (paddingTensorAppend.shape[paddingAxis] as number);
|
||||
|
||||
const paddingTensorPrepend = isCenterImage && remainingPaddingAmount
|
||||
? createPaddingTensor(remainingPaddingAmount)
|
||||
: null;
|
||||
|
||||
const tensorsToStack = [
|
||||
paddingTensorPrepend,
|
||||
imgTensor,
|
||||
paddingTensorAppend,
|
||||
]
|
||||
const paddingTensorPrepend = isCenterImage && remainingPaddingAmount ? createPaddingTensor(remainingPaddingAmount) : null;
|
||||
const tensorsToStack = [paddingTensorPrepend, imgTensor, paddingTensorAppend]
|
||||
.filter((t) => !!t)
|
||||
.map((t: tf.Tensor) => tf.cast(t, 'float32')) as tf.Tensor4D[];
|
||||
return tf.concat(tensorsToStack, paddingAxis);
|
||||
|
|
|
@ -4,11 +4,11 @@ export interface ISsdMobilenetv1Options {
|
|||
}
|
||||
|
||||
export class SsdMobilenetv1Options {
|
||||
protected _name = 'SsdMobilenetv1Options'
|
||||
protected _name = 'SsdMobilenetv1Options';
|
||||
|
||||
private _minConfidence: number
|
||||
private _minConfidence: number;
|
||||
|
||||
private _maxResults: number
|
||||
private _maxResults: number;
|
||||
|
||||
constructor({ minConfidence, maxResults }: ISsdMobilenetv1Options = {}) {
|
||||
this._minConfidence = minConfidence || 0.5;
|
||||
|
|
|
@ -3,5 +3,5 @@ import { ITinyYolov2Options, TinyYolov2Options } from '../tinyYolov2/index';
|
|||
export type ITinyFaceDetectorOptions = ITinyYolov2Options
|
||||
|
||||
export class TinyFaceDetectorOptions extends TinyYolov2Options {
|
||||
protected override _name = 'TinyFaceDetectorOptions'
|
||||
protected override _name = 'TinyFaceDetectorOptions';
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import { DefaultTinyYolov2NetParams, MobilenetParams, TinyYolov2NetParams } from
|
|||
export class TinyYolov2Base extends NeuralNetwork<TinyYolov2NetParams> {
|
||||
public static DEFAULT_FILTER_SIZES = [3, 16, 32, 64, 128, 256, 512, 1024, 1024];
|
||||
|
||||
private _config: TinyYolov2Config
|
||||
private _config: TinyYolov2Config;
|
||||
|
||||
constructor(config: TinyYolov2Config) {
|
||||
super('TinyYolov2');
|
||||
|
|
|
@ -4,11 +4,11 @@ export interface ITinyYolov2Options {
|
|||
}
|
||||
|
||||
export class TinyYolov2Options {
|
||||
protected _name = 'TinyYolov2Options'
|
||||
protected _name = 'TinyYolov2Options';
|
||||
|
||||
private _inputSize: number
|
||||
private _inputSize: number;
|
||||
|
||||
private _scoreThreshold: number
|
||||
private _scoreThreshold: number;
|
||||
|
||||
constructor({ inputSize, scoreThreshold }: ITinyYolov2Options = {}) {
|
||||
this._inputSize = inputSize || 416;
|
||||
|
|
|
@ -31,7 +31,7 @@ function mainBlock(x: tf.Tensor4D, params: MainBlockParams): tf.Tensor4D {
|
|||
}
|
||||
|
||||
export class TinyXception extends NeuralNetwork<TinyXceptionParams> {
|
||||
private _numMainBlocks: number
|
||||
private _numMainBlocks: number;
|
||||
|
||||
constructor(numMainBlocks: number) {
|
||||
super('TinyXception');
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue