2020-08-20 02:05:34 +02:00
|
|
|
"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,
|
2020-08-20 02:05:34 +02:00
|
|
|
iouThreshold: const_1.IOU_THRESHOLD,
|
2020-08-18 14:04:33 +02:00
|
|
|
classes: ['face']
|
|
|
|
}, withSeparableConvs
|
|
|
|
? {
|
2020-08-20 02:05:34 +02:00
|
|
|
anchors: const_1.BOX_ANCHORS_SEPARABLE,
|
|
|
|
meanRgb: const_1.MEAN_RGB_SEPARABLE
|
2020-08-18 14:04:33 +02:00
|
|
|
}
|
|
|
|
: {
|
2020-08-20 02:05:34 +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);
|
2020-08-20 02:05:34 +02:00
|
|
|
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() {
|
2020-08-20 02:05:34 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2020-08-20 02:05:34 +02:00
|
|
|
exports.TinyYolov2 = TinyYolov2;
|
2020-08-18 14:04:33 +02:00
|
|
|
//# sourceMappingURL=TinyYolov2.js.map
|