I'm not sure this is what you want... but found one problem:
You initialize the MediaPipe model (with mp_holistic.Holistic) and load the TF model (model = load_model()) in recv(), but this is not a good design,
because recv() is called on every frames so model loadings happen everytime a new frame arrives. It is not efficient.
You should do such computationally expensive but cachable processing only once, practically at __init__() method.
For example, this object detection demo does so as this
This app can be another example which uses MediaPipe for pose estimation.
It also initializes the model at __init__() like this.
Note that this version is using multiprocessing because MediaPipe running in a single process had a problem with Streamlit in a multi-user situation. If your case is not so, you can refer to this previous version.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Okey, I have tried to hardcode a string into the putText function and it works:
So I am thinking that there might be some problem with the Machine Learning part...
This is the code for my app, could you please look at it and reply if there is something wrong?
About the utils module, just some functions and the model definition, but they seem to work as it shows in the result that my face is landmarked.
I'm not sure this is what you want... but found one problem:
You initialize the MediaPipe model (
with mp_holistic.Holistic
) and load the TF model (model = load_model()
) inrecv()
, but this is not a good design,because
recv()
is called on every frames so model loadings happen everytime a new frame arrives. It is not efficient.You should do such computationally expensive but cachable processing only once, practically at
__init__()
method.For example, this object detection demo does so as this
This app can be another example which uses MediaPipe for pose estimation.
It also initializes the model at
__init__()
like this.Note that this version is using
multiprocessing
because MediaPipe running in a single process had a problem with Streamlit in a multi-user situation. If your case is not so, you can refer to this previous version.