Skip to content

[tfjs-backend-wasm] - chrome tab becomes unresponsive when trying to apply the bokeh effect using wasm backend #2723

@jallamsetty1

Description

@jallamsetty1

TensorFlow.js version

1.5.1

Browser version

Chrome - 79.0.3945.130

Describe the problem or feature request

I am using the bodyPix model for doing person segmentation and then using the segmentation data for drawing the bokeh effect on a HTML canvas. The chrome tab becomes unresponsive when I try to set the backend to 'wasm'. There are no issues when I use the 'webgl' backend.

Code to reproduce the bug / link to feature request

import * as bodyPix from '@tensorflow-models/body-pix';
import * as tf from '@tensorflow/tfjs';
import '@tensorflow/tfjs-backend-wasm';

await tf.setBackend('wasm');

const bpModel = await bodyPix.load({
        architecture: 'MobileNetV1',
        outputStride: 16,
        multiplier: 0.75,
        quantBytes: 2
    });

const segmentationData = await bpModel.segmentPerson(this._inputVideoElement, {
        internalResolution: 'low', // resized to 0.25 times of the original resolution before inference
        maxDetections: 1, // max. number of person poses to detect per image
        segmentationThreshold: 0.7 // represents probability that a pixel belongs to a person
 });
bodyPix.drawBokehEffect(
        this._outputCanvasElement,
        this._inputVideoElement,
        segmentationData,
        15, // Constant for background blur, integer values between 0-20
         7 // Constant for edge blur, integer values between 0-20
);

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions