How to optimize loading time
Is it always necessary to do initialization every time we use the frontend API library?
The anonymization sequence is composed of a few steps that are required to work properly.
What does the sequence flow looks like?
- Asking the final user for access to his local camera
- Accessing camera
- Downloading anonymisation model
- Initializing the API with API Key
- Establishing a secured connection to the cloud API
- While the facial expression recognition service is required
- Computing images from the camera on-device with the anonymization model
- Sending on-the-fly anonymized facial keypoints to the cloud API
- Receiving estimation for each emotion and social cues through a secured channel
- Closing the channel
- Releasing access to the camera
Optimization strategies
At step 3, there is an approx. 120MB model that is downloaded, then warming up the computation can take time until the first facial keypoints are computed. As soon as the first data is sent, the initialization phase is done.
There might be possibilities to optimize the initialization process by :
- pre-loading the model and starting computation of anonymized data in advance, at the cost of using CPU while not requested by a user action.
- caching the anonymization model
- keep the camera active
All these strategies requires adaptation to the use case, thus cannot be implemented as default features for the API.
So, how is it possible to optimize?
💡 The API is Open Source and available on GitHub . If you're interested at building some optimization, you can submit an issue or even better a pull request with your own suggestions. For personalized optimization : feel free to ask, we will be happy to help : Contact the team