Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the existing posenet model with pose-detection model #1

Open
shivaylamba opened this issue Jan 24, 2024 · 1 comment
Open

Update the existing posenet model with pose-detection model #1

shivaylamba opened this issue Jan 24, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@shivaylamba
Copy link
Owner

Posenet model has been deprecated.

Replace the existing model with one of the new pose-detection models:

  1. Movenet
  2. Blazepost
  3. PoseNet

Compare the performance between the 3 and check how you can solve this.

Copy link

dosubot bot commented Jan 24, 2024

🤖

Hey @shivaylamba, good to see you again! Hope you're doing well and ready to delve into some more ML magic.

To replace the existing posenet model with one of the new pose-detection models (Movenet, Blazepost, or PoseNet), you will need to update the init function in the index.js file where the model is loaded.

Here is a general idea of how you can modify the function to load a new model:

async function init(modelName) {
    var modelURL;
    var metadataURL;

    switch(modelName) {
        case 'Movenet':
            modelURL = 'path/to/movenet/model.json';
            metadataURL = 'path/to/movenet/metadata.json';
            break;
        case 'Blazepost':
            modelURL = 'path/to/blazepost/model.json';
            metadataURL = 'path/to/blazepost/metadata.json';
            break;
        case 'PoseNet':
            modelURL = 'path/to/posenet/model.json';
            metadataURL = 'path/to/posenet/metadata.json';
            break;
        default:
            console.log('Invalid model name');
            return;
    }

    // load the model and metadata
    model = await tmPose.load(modelURL, metadataURL);
    maxPredictions = model.getTotalClasses();

    // ... rest of the function
}

In this code, modelName is used to decide which model to load. Depending on the value of modelName, the URLs for the model and metadata are set accordingly.

Please note that you will need to replace 'path/to/movenet/model.json', 'path/to/blazepost/model.json', and 'path/to/posenet/model.json' with the actual URLs or paths to the models and metadata files.

As for the dependencies, the TensorFlow.js Pose Detection API supports the Movenet and Blazepose models, so you will need to include the TensorFlow.js library in your project if it's not already included. You can do this by adding the following line to your HTML file:

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>

And then you can load the models using the tf.loadGraphModel function:

const model = await tf.loadGraphModel('path/to/model.json');

For more information on how to use the TensorFlow.js Pose Detection API, you can refer to the official documentation.

As for comparing the performance between the three models, you can use the model.estimatePoses function to get the poses from the model and then measure the time it takes to get the poses. You can do this for each model and then compare the times.

Please note that the performance may vary depending on the specific use case and the hardware that the models are run on. Therefore, it's recommended to test the models on the actual devices that will be used by the end users.

I hope this helps! If you have any other questions, feel free to ask.

-Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added the enhancement New feature or request label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant