Code Monkey home page Code Monkey logo

Comments (15)

ryan-cha avatar ryan-cha commented on June 15, 2024 8

Same here.
image

Following is the list of npm package and version I'm using.

$ yarn list --pattern tensorflow

yarn list v1.22.19
├─ @tensorflow-models/[email protected]
├─ @tensorflow/[email protected]
├─ @tensorflow/[email protected]
├─ @tensorflow/[email protected]
├─ @tensorflow/[email protected]
├─ @tensorflow/[email protected]
├─ @tensorflow/[email protected]
├─ @tensorflow/[email protected]
└─ @tensorflow/[email protected]
  • OS: macOS (Sonoma 14.4.1)
  • Browser: Chrome (Version 123.0.6312.107 (Official Build) (x86_64))

import { SupportedModels,  movenet,  createDetector } from '@tensorflow-models/pose-detection';

createDetector(SupportedModels.MoveNet, {
   modelType: movenet.modelType.SINGLEPOSE_LIGHTNING,
   modelUrl: 'https://xxxx.my.own.domain.space/mymodelfolder/model.json'
})

After uploading the model files to my own storage, specifying its url makes it work. However, do I REALLY have to serve the model files myself? 😬

from tfjs.

vansh-agg avatar vansh-agg commented on June 15, 2024 7

You will have to disable cors in chrome

Go to the directory where chrome.exe file is located and open command prompt there
and paste
chrome.exe --user-data-dir="C://Chrome dev session" --disable-web-security

this will open chrome window with disabled cors. Now run your model on this chrome window.

from tfjs.

sepretf avatar sepretf commented on June 15, 2024 4

Hello, same here. The temporary solution from @ryan-cha work well TY, you can try with with my storage if needed:

createDetector(SupportedModels.MoveNet, {
modelType: movenet.modelType.SINGLEPOSE_LIGHTNING,
modelUrl: 'https://www.posetracker.com/scripts/tmp_model_to_remove.json'
})

from tfjs.

gaikwadrahul8 avatar gaikwadrahul8 commented on June 15, 2024 2

Hi, All

I apologize for the delayed response and thank you for bringing this issue to our attention and @ryan-cha thanks a lot for your workaround, I was trying to replicate the same issue from my end with official tensorflow demos and with below code snippet but I'm unable to replicate the same issue now from my end or Am I missing something here, if so please let me know ?

Could you please give it try from your end now and let us know is it working as expected or not ? if issue still persists please let us know with code snippet and error log to investigate this issue further from our end ?

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>TensorFlow.js Movenet model testing</title>
  </head>
  <body>
    <!-- Require the peer dependencies of pose-detection. -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
    <!-- You must explicitly require a TF.js backend if you're not using the TF.js union bundle. -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
    <!-- Alternatively you can use the WASM backend: <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm/dist/tf-backend-wasm.js"></script> -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/pose-detection"></script>

    <script>
      // Replace with your actual TensorFlow.js code
      async function main() {
        await tf.setBackend("webgl");
        await tf.ready();

        const detectorConfig = {
          modelType: poseDetection.movenet.modelType.SINGLEPOSE_LIGHTNING,
        };
        const detector = await poseDetection.createDetector(
          poseDetection.SupportedModels.MoveNet,
          detectorConfig
        );
        console.log(detector);
      }

      main(); // Call the main function to start execution
    </script>
  </body>
</html>

Output of above index.html file :

image

Thank you for your cooperation and patience.

from tfjs.

ryan-cha avatar ryan-cha commented on June 15, 2024 1

@teje87 I'm using Movenet thunder and it's here.

Find the download button and download the whole files using "download as tar.gz".

Extract it and put all the files at the same level, and point "model.json". Then, the other files should be loaded accordingly.

from tfjs.

moorjani-ajay avatar moorjani-ajay commented on June 15, 2024 1

Thanks @ryan-cha your solution made it work

from tfjs.

ryan-cha avatar ryan-cha commented on June 15, 2024 1

@gaikwadrahul8
I tried your html file and my production code as well and, it seems that we all had a real bad dream last night. 😂

Now it's working ok as you observed, meaning the issue is gone.

Lessons learned:

  • The model files THEY serve can be unreachable from time to time. (There are posts about this cors issue even from the past)
  • If it happens, I should persuade my clients/boss to hold a bit, not knowing when it'll be fixed. 🤷‍♂️

Conclusion:

  • For customer-facing or critical projects, I'd rather serve model files myself for the peace in my mind.

from tfjs.

momomuchu avatar momomuchu commented on June 15, 2024

same here

from tfjs.

moorjani-ajay avatar moorjani-ajay commented on June 15, 2024

@momomuchu I am stuck in the same situation, did you manage to make it work ?

from tfjs.

moorjani-ajay avatar moorjani-ajay commented on June 15, 2024

Can't ask a user to disable do I? That's not a solution @vansh-agg

from tfjs.

teje87 avatar teje87 commented on June 15, 2024

I'm facing the same error. Can't make it work even using my own model.json, maybe I'm using the wrong one. @ryan-cha Where did you download the model from?

from tfjs.

teje87 avatar teje87 commented on June 15, 2024

I was using a wrong model version downloaded from kaggle. The temporary solution @ryan-cha proposed is working for me.

from tfjs.

gaikwadrahul8 avatar gaikwadrahul8 commented on June 15, 2024

Hi, @ryan-cha

Thank you for the confirmation and I'm glad to hear the issue seems to be resolved and your code is working as expected now! Thanks for sharing your experience and insights. It's definitely a good point that external model files can be subject to occasional unavailability for some time due to various factors but now things are working as expected.

Hi, @abhishekvasu94

I'd appreciate it if you could verify on your end that everything is functioning as intended. If so, please feel free to close this issue now.

Thank you for your cooperation and patience.

from tfjs.

abhishekvasu94 avatar abhishekvasu94 commented on June 15, 2024

Thanks @gaikwadrahul8. I can confirm it works. Closing this issue

from tfjs.

google-ml-butler avatar google-ml-butler commented on June 15, 2024

Are you satisfied with the resolution of your issue?
Yes
No

from tfjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.