face-api/build/tinyYolov2/TinyYolov2.js

42 lines
1.5 KiB
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TinyYolov2 = void 0;
const classes_1 = require("../classes");
const const_1 = require("./const");
const TinyYolov2Base_1 = require("./TinyYolov2Base");
class TinyYolov2 extends TinyYolov2Base_1.TinyYolov2Base {
2020-08-18 14:04:33 +02:00
constructor(withSeparableConvs = true) {
const config = Object.assign({}, {
withSeparableConvs,
iouThreshold: const_1.IOU_THRESHOLD,
2020-08-18 14:04:33 +02:00
classes: ['face']
}, withSeparableConvs
? {
anchors: const_1.BOX_ANCHORS_SEPARABLE,
meanRgb: const_1.MEAN_RGB_SEPARABLE
2020-08-18 14:04:33 +02:00
}
: {
anchors: const_1.BOX_ANCHORS,
2020-08-18 14:04:33 +02:00
withClassScores: true
});
super(config);
}
get withSeparableConvs() {
return this.config.withSeparableConvs;
}
get anchors() {
return this.config.anchors;
}
async locateFaces(input, forwardParams) {
const objectDetections = await this.detect(input, forwardParams);
return objectDetections.map(det => new classes_1.FaceDetection(det.score, det.relativeBox, { width: det.imageWidth, height: det.imageHeight }));
2020-08-18 14:04:33 +02:00
}
getDefaultModelName() {
return this.withSeparableConvs ? const_1.DEFAULT_MODEL_NAME_SEPARABLE_CONV : const_1.DEFAULT_MODEL_NAME;
2020-08-18 14:04:33 +02:00
}
extractParamsFromWeigthMap(weightMap) {
return super.extractParamsFromWeigthMap(weightMap);
}
}
exports.TinyYolov2 = TinyYolov2;
2020-08-18 14:04:33 +02:00
//# sourceMappingURL=TinyYolov2.js.map