Skip to content

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?

  1. Asking the final user for access to his local camera
  2. Accessing camera
  3. Downloading anonymisation model
  4. Initializing the API with API Key
  5. Establishing a secured connection to the cloud API
  6. While the facial expression recognition service is required
    1. Computing images from the camera on-device with the anonymization model
    2. Sending on-the-fly anonymized facial keypoints to the cloud API
    3. Receiving estimation for each emotion and social cues through a secured channel
  7. Closing the channel
  8. 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