face-api/build/ageGenderNet/extractParamsFromWeigthMap.js

23 lines
913 B
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractParamsFromWeigthMap = void 0;
const common_1 = require("../common");
function extractParamsFromWeigthMap(weightMap) {
2020-08-18 14:04:33 +02:00
const paramMappings = [];
const extractWeightEntry = common_1.extractWeightEntryFactory(weightMap, paramMappings);
2020-08-18 14:04:33 +02:00
function extractFcParams(prefix) {
const weights = extractWeightEntry(`${prefix}/weights`, 2);
const bias = extractWeightEntry(`${prefix}/bias`, 1);
return { weights, bias };
}
const params = {
fc: {
age: extractFcParams('fc/age'),
gender: extractFcParams('fc/gender')
}
};
common_1.disposeUnusedWeightTensors(weightMap, paramMappings);
2020-08-18 14:04:33 +02:00
return { params, paramMappings };
}
exports.extractParamsFromWeigthMap = extractParamsFromWeigthMap;
2020-08-18 14:04:33 +02:00
//# sourceMappingURL=extractParamsFromWeigthMap.js.map