The configuration process of the SDK has severable responsibilities:
Validation of the license key
Validating the currently present files
Downloading or updating the files required by the SDK to do recognition
Preparing the files to be used for inference
The SDK is configured using a PassioConfiguration
object. This object is used to define the location of the files that the SDK requires.
The default behaviour (or by setting the sdkDownloadsModels field to true) of the SDK is to download the required files. If the current files that are present on the device are older than the version of the SDK library, the SDK will download the newer version in the background, but still run the session with the older version of the files. Once the download is finished, the new files will be applied on the next session. Don't forget to add the import statement for the nutrition sdk.
The result of the configuration process is a PassioStatus
object, containing a PassioMode attribute along with the missingFiles, debugMessage, error object and the active models number. The attribute that needs to looked at is the mode.
PassioMode
is an enum describing the current state of the Passio SDK configuration process:
notReady -> The configuration process hasn't started yet.
failedToConfigure -> There was an error during the configuration process.
isBeingConfigured -> The SDK is still in the configuration process. Normally, you shouldn't receive this mode as a callback to the configure method. If you do please contact our support team.
isDownloadingModels -> The files required by the SDK to work are not present and are currently being downloaded.
isReadyForDetection -> The SDK is configured with the set of files defined by the activeModels attribute.
The missingFiles variable contains a list of all the files missing for the SDK to work optimally. When this list is not null, this doesn't mean that the SDK is not operational. The SDK may be initialized with older files, but it will advocate the download of the newest files through this list.
The debugMessage usually gives more verbose and human-readable information about the configuration process. It will always give an error message if the mode is FAILED_TO_CONFIGURE.
The activeModels will give the version of the files installed and ran by the SDK if the configuration process ran successfully i.e. if the mode is IS_READY_FOR_DETECTION.
Make sure there is internet connection for the configuration process. The SDK needs to download the license file and the required files. If there is no internet connection the configuration status mode will be failedToConfigure.
The PassioStatus mode is notReady -> check debugMessage for the error, usually the wrong license key has been supplied or the files are missing.
The PassioStatus mode is isDownloadingModels -> register a PassioStatusListener
through the setPassioStatusListener method as it will enable tracking of the download progress.
The PassioStatus mode is isReadyForDetection -> still check the missingFiles because the SDK might be running with an older version of the files and newer need to be downloaded.