1

I'm using react with TensorFlow + bodypix for blur background on live video. For video streaming, I use Vonage (TokBox).

How I blur background

function segmentBodyInRealTime() {
    async function bodySegmentationFrame() {
      const multiPersonSegmentation = await estimateSegmentation(video);

      drawBokehEffect(
        canvas, video, multiPersonSegmentation, backgroundBlurAmount, edgeBlurAmount, props.flipHorizontal);

      requestAnimationFrame(bodySegmentationFrame);
    }

    bodySegmentationFrame();
  }

  async function estimateSegmentation(image) {
    let multiPersonSegmentation = null;

    return await net.segmentPerson(image, {
      internalResolution: props.internalResolution,
      segmentationThreshold: props.segmentationThreshold,
      maxDetections: props.maxDetections,
      scoreThreshold: props.scoreThreshold,
      nmsRadius: props.nmsRadius,
    });
  }

And the question is, How to stop blurring? Or how I can stop/destroy BodyPix?

I tried tf.engine().endScope(); and net.dispose(); but got error enter image description here

Vadim
  • 68
  • 6

0 Answers0