intel / webml-polyfill

Deprecated, the Web Neural Network Polyfill project has been moved to https://github.com/webmachinelearning/webnn-polyfill
Apache License 2.0
161 stars 42 forks source link

The detection result by WebGL2 backend is different from the one by WASM backend on Android Pixel 2. #182

Closed BruceDai closed 5 years ago

BruceDai commented 6 years ago
BruceDai commented 6 years ago

This issue is not reproduced on Mac OS platform. @sunlin-link PTAL

BruceDai commented 6 years ago

ssd_mobilenet-webgl2.log

BruceDai commented 6 years ago

This issue is also reproduced by Chrome (68.0.3440.91), so it's relevant to the changed code of webgl, we will bisect the commit.

BruceDai commented 6 years ago

console log says: webml-polyfill.js:955 Uncaught (in promise) Error: [Tensor] numSlices 22 > MAX_TEXTURE_IMAGE_UNITS 16 at Tensor._createTextureSlices (webml-polyfill.js:955) at Tensor.createGLTexture (webml-polyfill.js:888) at Input.call (webml-polyfill.js:21574) at webml-polyfill.js:8169 at Map.forEach () at webml-polyfill.js:8168 at Array.forEach () at webml-polyfill.js:8158 at new Promise () at Model._execute (webml-polyfill.js:8150)

BruceDai commented 6 years ago

The root case is that in https://github.com/intel/webml-polyfill/blob/master/src/nn/webgl2/Tensor.js#L119

    L119 const numSlices = Math.ceil(this.textureShape[0] / webgl2.MAX_TEXTURE_SIZE);
    L120 if (numSlices > webgl2.MAX_TEXTURE_IMAGE_UNITS) {
    L121   throw new Error(`[Tensor] numSlices ${numSlices} > MAX_TEXTURE_IMAGE_UNITS ${webgl2.MAX_TEXTURE_IMAGE_UNITS}`);
    L122 }

On Android platform webgl2.MAX_TEXTURE_SIZE is 4096 while on Windows and Mac OS platforms webgl2.MAX_TEXTURE_SIZE both are 16384

So execution on Android platform, the #L120 if condition would be satisfied, then error would be thrown.

GreyZzzzzzXh commented 6 years ago

Hi @BruceDai , I remove this check code via #215 , could you please help verify whether the result is correct?

GreyZzzzzzXh commented 5 years ago

Fixed by #215.

Christywl commented 5 years ago

Verified this with the latest codes, it can't reproduce.