face-api/build/tinyFaceDetector/TinyFaceDetector.js

35 lines
1.3 KiB
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TinyFaceDetector = void 0;
const classes_1 = require("../classes");
const TinyYolov2Base_1 = require("../tinyYolov2/TinyYolov2Base");
const const_1 = require("./const");
class TinyFaceDetector extends TinyYolov2Base_1.TinyYolov2Base {
2020-08-18 14:04:33 +02:00
constructor() {
const config = {
withSeparableConvs: true,
iouThreshold: const_1.IOU_THRESHOLD,
2020-08-18 14:04:33 +02:00
classes: ['face'],
anchors: const_1.BOX_ANCHORS,
meanRgb: const_1.MEAN_RGB,
2020-08-18 14:04:33 +02:00
isFirstLayerConv2d: true,
filterSizes: [3, 16, 32, 64, 128, 256, 512]
};
super(config);
}
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 'tiny_face_detector_model';
}
extractParamsFromWeigthMap(weightMap) {
return super.extractParamsFromWeigthMap(weightMap);
}
}
exports.TinyFaceDetector = TinyFaceDetector;
2020-08-18 14:04:33 +02:00
//# sourceMappingURL=TinyFaceDetector.js.map