-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
BodyPix tflite model support #11
Comments
Hey @charliesantos, thanks for reaching out. Indeed @PINTO0309 is doing an awesome work on these model conversions!
Not sure how easy it would be, I'll try to investigate a little bit. |
Thank you @Volcomix . It would be nice to at least use bodypix in wasm for the virtual background use case like the ones you have in this repo for google meet, ML Kit, and bodypix tfjs. No need to detect different poses. |
I created a branch to experiment on BodyPix tflite models. I understand that the 4th output is supposed to hold the segmentation but I don't really understand how to work with its 20x15 resolution, even after looking into TF.js source code. The inference time is good but I guess this one is for the worst accuracy. Not sure how promising it is. The output is unusable for now: I'm not sure I will invest a lot more time on it so any help would be welcome. |
I have not written any sample code, but the following repository may be helpful. The last time I converted the model was a long time ago (about a year ago), so I will try to convert it again with the latest knowledge. |
Awesome! Thanks for the update I'm gonna take a look. |
@Volcomix I think we need to scale the height and width of the output according to the width of the stride. |
All the models were re-transformed and totally replaced with the same model structure of TensorFlow.js. |
Thank you @PINTO0309 @Volcomix you both are amazing! |
I found a better sample. |
Here is the one that was easiest to understand. |
Thank you so much @PINTO0309. I can see that the new model output still has a resolution of 15x20 so I need to figure out how to map this on a 240x320 image. Hopefully I'll find the answer in the samples you found for us 🤞. |
After loading the new tflite models and trying with the fastest one (mobilenet050, stride16, 240x320, float16 quantization), the performance seems equivalent/worse with tflite on wasm than with tfjs on webgl. Moreover the tfjs one works on a higher resolution: After checking other projects code and the tfjs implementation of BodyPix more closely, I would have to handle padding and scaling implied by the strides which is implemented using tensorflow in all the reference projects but would require a lot of extra work in this demo. As the performance results are not that good with the tflite model of BodyPix, I don't wish to invest more time on this specific experiment. I'm very sorry PINTO for making you spend time on it without ending. P.S.: There is a work in progress in TF.js to handle tflite models. Maybe is there a chance that BodyPix would work on it when it will be ready: https://github.com/tensorflow/tfjs/tree/master/tfjs-tflite |
@Volcomix I am currently playing around with the openvino model provided by @PINTO0309 and I am was able to detect the keypoints of a person. However, the |
@Volcomix , your work is really impressive! Thank you so much for this work.
I saw this comment from @PINTO0309 in this issue #2 (comment)
And I'm able to easily play with the different models. Thank you both for your hardwork.
I noticed @PINTO0309 also has bodypix tflite models here but they don't seem to work with @Volcomix pipeline. Getting some logs I noticed the output image has the following:
As you can see, the output seems wrong. Any advice on what to adjust? My intention is I want to run bodypix model in wasm hoping to gain more performance than the tfjs one. Is this something you can help with? Thank you in advance!
The text was updated successfully, but these errors were encountered: