mirror of https://github.com/vladmandic/human
18 lines
593 B
JavaScript
18 lines
593 B
JavaScript
![]() |
const tf = require('@tensorflow/tfjs');
|
||
|
const modelBase = require('./modelBase');
|
||
|
|
||
|
class MobileNet extends modelBase.BaseModel {
|
||
|
// eslint-disable-next-line class-methods-use-this
|
||
|
preprocessInput(input) {
|
||
|
// Normalize the pixels [0, 255] to be between [-1, 1].
|
||
|
return tf.tidy(() => tf.div(input, 127.5).sub(1.0));
|
||
|
}
|
||
|
|
||
|
// eslint-disable-next-line class-methods-use-this
|
||
|
nameOutputResults(results) {
|
||
|
const [offsets, heatmap, displacementFwd, displacementBwd] = results;
|
||
|
return { offsets, heatmap, displacementFwd, displacementBwd };
|
||
|
}
|
||
|
}
|
||
|
exports.MobileNet = MobileNet;
|