Skip to main content

Resources versioning

Our developers constantly improve the Banuba SDK. Among other things, we work on enhancing the neural networks (NN) resources. Sometimes this requires significant changes in resources and can lead to the loss of backward compatibility. In this case, the newest version of the SDK demands the newest resource.

If you use resources directly from the SDK build, you have nothing to worry about. The SDK build is always deployed with compatible resources. But if you use external resources (on IOS or Android), you have to implement a special compatibility check for these resources and the SDK.

Resources versioning system

Version of the single NN resource

Each NN resource on the Banuba SDK side has its own version. The version of NN resources consists of 3 parts: major, minor and patch.

  • The major will be changed in case of vast changes in the resource (such as changes in the architecture)
  • The minor will be changed in case of improvements that change the input interface.
  • The patch will be changed in case of some inner improvements which don’t influence the input interface.

Version of the archive with resources

Every build of the Banuba SDK contains info about the target version of the archive with resources which it has been built for. This version is just a sum of the versions of all resources. It has the same parts (major, minor and patch).

note

The text above implies that only the changes in major and minor parts of the NN resources archive version require replacement for the new resources archive. If changes are in the major part, you must immediately replace the resources. And if the changes are only in minor part, the replacement can be postponed or performed in the background while user works with your app.

API for control of the version of the archive with resources

For control of the version of the resources archive you should use the bnb::interfaces::utility_mananger class (UtilityManager class on Android or BNBUtilityManager on IOS). Besides other functionality, this class has several functions that help you with this.

  • get_banuba_sdk_resources_version_string() - returns the target version of resources of the SDK as string, represented in the format “Major.Minor.Patch”.

  • get_banuba_sdk_resources_version() - returns the target version of the SDK as number (int). You can find the description of the format of the value in the documentation.

  • get_banuba_sdk_resources_version_archive_string() - returns the version of external resources archive as string, represented in the format “Major.Minor.Patch”. It should be called only after the initialization of the Banuba SDK. This version is the same as the Banuba SDK resources version if no external resources are used.

  • check_banuba_sdk_resources_version() - returns true, if the version of external resources is equal to the Banuba SDK resources version.

  • check_banuba_sdk_resources_version_ignore_patch() - returns true, if the Banuba SDK treats the version of external resources as valid (major and minor parts of the versions match).

Example of the resources archive version check:

// #include <bnb/recognizer/interfaces/utility_manager.hpp>
// bnb::interfaces::utility_manager::initialize(...);
// ...

if (!bnb::interfaces::utility_manager::check_banuba_sdk_resources_version_ignore_patch()) {
//Download new archive with resources
}