tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.37k stars 1.92k forks source link

D3D shader compliation failed with skip optimization flags #1337

Closed Cha-Dahee closed 5 years ago

Cha-Dahee commented 5 years ago

To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.

TensorFlow.js version

1.0.0

Browser version

Google Chrome Version 72.0.3626.121 (Official Build) (64-bit)

Describe the problem or feature request

Hi I'm using Posenet for my project. After the latest update of Posenet version (from 0.2.3 to 1.0.0), I got an error message like below. Right now I'm using posenet version 0.2.3 and tensorflow 0.15.3 for my project as it works well with them. So fixing this is not urgent for me, but I'm reporting it here anyway. I hope to use the latest version later. Thx!

1. Message on console C:\fakepath(77,32-58): warning X3556: integer divides may be much slower, try using uints if possible. C:\fakepath(78,32-80): warning X3556: integer divides may be much slower, try using uints if possible. C:\fakepath(116,33-81): error X4010: Unsigned integer divide by zero C:\fakepath(116,33-81): error X4010: Unsigned integer divide by zero C:\fakepath(116,33-81): warning X3556: integer divides may be much slower, try using uints if possible.

Warning: D3D shader compilation failed with default flags. (ps_5_0) Retrying with skip validation C:\fakepath(77,32-58): warning X3556: integer divides may be much slower, try using uints if possible. C:\fakepath(78,32-80): warning X3556: integer divides may be much slower, try using uints if possible. C:\fakepath(116,33-81): error X4010: Unsigned integer divide by zero C:\fakepath(116,33-81): error X4010: Unsigned integer divide by zero C:\fakepath(116,33-81): warning X3556: integer divides may be much slower, try using uints if possible.

Warning: D3D shader compilation failed with skip validation flags. (ps_5_0) Retrying with skip optimization C:\fakepath(77,32-58): warning X3556: integer divides may be much slower, try using uints if possible. C:\fakepath(78,32-80): warning X3556: integer divides may be much slower, try using uints if possible. C:\fakepath(116,33-81): error X4010: Unsigned integer divide by zero C:\fakepath(116,33-81): error X4010: Unsigned integer divide by zero C:\fakepath(116,33-81): warning X3556: integer divides may be much slower, try using uints if possible.

Warning: D3D shader compilation failed with skip optimization flags. (ps_5_0)

Failed to create D3D Shaders

Error: Failed to link vertex and fragment shaders

Code to reproduce the bug / link to feature request

1. Part of my code: const pose = await net.estimateSinglePose($video, imageScaleFactor, flipHorizontal, outputStride);

ToonTalk commented 5 years ago

Before getting this error I get

TypeError: t.fromPixels is not a function

This is from this sample page: https://github.com/tensorflow/tfjs-models/tree/master/posenet#via-script-tag

Changing it to t.browser.fromPixels then results in the error reported in this issue.

<html>
  <head>
    <!-- Load TensorFlow.js -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
    <!-- Load Posenet -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/posenet"></script>
 </head>

  <body>
    <img id='cat' src='cat.jpg '/>
  </body>
  <!-- Place your code in the script tag below. You can also use an external .js file -->
  <script>
    var imageScaleFactor = 0.5;
    var outputStride = 16;
    var flipHorizontal = false;

    var imageElement = document.getElementById('cat');

    posenet.load().then(function(net){
      return net.estimateSinglePose(imageElement, imageScaleFactor, flipHorizontal, outputStride)
    }).then(function(pose){
      console.log(pose);
    })
  </script>
</html>
parthi2929 commented 5 years ago

@Cha-Dahee are you not getting a tf.fromPixels method changed warning with that version?? what is your work around? after 0.2.3, posenet has 1.0.0 directly

davidsoergel commented 5 years ago

I wonder if this is related to the various Windows WebGL issues: https://github.com/tensorflow/tfjs/issues/1400

Here the same error appears but specifically in MS Edge: https://stackoverflow.com/questions/55188619/ms-edge-script5022-failed-to-link-vertex-and-fragment-shaders

dsmilkov commented 5 years ago

Can you run tf.ENV.set('WEBGL_PACK', false) right after you load the TF.js library and let me know if it helps so we can narrow down the problem. Thanks!

ToonTalk commented 5 years ago

Has this fix propagated to

https://cdn.jsdelivr.net/npm/@tensorflow/tfjs and https://cdn.jsdelivr.net/npm/@tensorflow-models/posenet

I still get the same errors when running the sample code at

https://github.com/tensorflow/tfjs-models/tree/master/posenet#via-script-tag

dsmilkov commented 5 years ago

Not yet, this fix will go in our next release tfjs@1.0.4 which will come out next week. If you are using posenet, you will have to wait for posenet's next release too, which we plan to do next week as well

hpssjellis commented 5 years ago

Not yet, this fix will go in our next release tfjs@1.0.4 which will come out next week. If you are using posenet, you will have to wait for posenet's next release too, which we plan to do next week as well

Also waiting for this fix. Brings up the question. Does Posenet have some script tag version history? The change to 1.0.0 broke a few of my old examples that use the live link. Would appreciate being able to download an old version while I look into how to make updates. I can probably find an old version using github desktop, but other people might be in the same boat as me.

https://hpssjellis.github.io/tensorflowjs-bvh/cam/index.html

https://hpssjellis.github.io/tensorflowjs-bvh/save-video/index.html

https://hpssjellis.github.io/beginner-tensorflowjs-examples-in-javascript/tf-examples/posenet/camera/index.html

Most of my examples were done around TFJS version 0.11.4. perhaps @oveddan has an old version for us to download.

hpssjellis commented 5 years ago

Well that was strangely easy.

I was going to fork tfjs-models for posenet , but it said I already had a version, then I was going to put it on cloud9 at http://c9.io to compile it, but found an old version, looked in the "dist" folder and found "posenet.min.js". Renamed it and put it on my fork at:

https://github.com/hpssjellis/tfjs-models/blob/master/posenet.v011.min.js

and my old examples work again :)

ethanweber commented 5 years ago

Also looking forward to this fix. The real-time speed of 1.0.0 isn't comparable to 0.2.3. I was planning to launch a product tomorrow using posenet-related work. @dsmilkov do you happen to know when exactly 1.0.4 will be released? Thanks!

hpssjellis commented 5 years ago

So I got my Posenet working with tfjs version 1.0.4, which now does not give the shader error that version 1.0.3 was showing for single-pose, but strangely single-pose seems to not be refreshing the screen. mult-ipose works fine. image

I think the issue is probably in the function estimateSinglePose, wondering if this is only for my implementation or if others are seeing this. I also probably have the CPU fall back as my version seems kind of slow.