Merge pull request #34 from patrickhulce/patch-1
fix: return empty descriptor for zero-sized facespull/39/head
commit
09b2e8215d
|
@ -61,6 +61,10 @@ export class FaceRecognitionNet extends NeuralNetwork<NetParams> {
|
|||
}
|
||||
|
||||
public async computeFaceDescriptor(input: TNetInput): Promise<Float32Array|Float32Array[]> {
|
||||
// When faces have a detected dimension of 0, tensorflow will crash the whole process.
|
||||
// Sidestep this by returning an empty descriptor instead.
|
||||
if (input.shape.some(dimension => dimension <= 0) return new Float32Array(128);
|
||||
|
||||
const netInput = await toNetInput(input);
|
||||
|
||||
const faceDescriptorTensors = tf.tidy(
|
||||
|
|
Loading…
Reference in New Issue