face-api/build/classes/PredictedBox.js

19 lines
780 B
JavaScript
Raw Normal View History

2020-08-20 02:10:42 +02:00
import { isValidProbablitiy } from '../utils';
import { LabeledBox } from './LabeledBox';
export class PredictedBox extends LabeledBox {
2020-08-18 14:04:33 +02:00
constructor(box, label, score, classScore) {
super(box, label);
this._score = score;
this._classScore = classScore;
}
static assertIsValidPredictedBox(box, callee) {
2020-08-20 02:10:42 +02:00
LabeledBox.assertIsValidLabeledBox(box, callee);
if (!isValidProbablitiy(box.score)
|| !isValidProbablitiy(box.classScore)) {
2020-08-18 14:04:33 +02:00
throw new Error(`${callee} - expected properties score (${box.score}) and (${box.classScore}) to be a number between [0, 1]`);
}
}
get score() { return this._score; }
get classScore() { return this._classScore; }
}
//# sourceMappingURL=PredictedBox.js.map