I'm using SDK 9.8.5 on iOS (native).
We've got a large dataset that we load (hundreds of image targets), and this loading process takes a long time. Even if we load from a local file that's in our app bundle, this can take up to 10 seconds on an iPhone X. This means that while it's loading, we can (A) show the user a loading screen, or (B) show them a live camera that won't recognize any targets. Neither of these options is good.
The documentation for DataSet's "load" function mentions:
Note that loading of data sets may take a significant amount of time, and it is therefore recommended to do this on a background thread.
With that in mind, what's the right way to preload this data? Specifically, we want to load it in advance, while users are not in the "camera" screen part of our app, and then just activate the DataSet when we normally fire up the Vuforia view.
The normal startup process of Vuforia in the demo app is something like this:
- VuforiaViewController's viewDidLoad calls initAR, setting itself up for a callback - AppController.cpp sets init params and calls an internal initvuforia function - init trackers - init device tracker - init object tracker - load tracker data - load and activate the relevant dataset - send callback back to VuforiaViewController's viewDidLoad method: - VuforiaViewController's viewDidLoad callback closure calls AppController's "startAR" - init CameraDevice - selectVideoMode - start trackers! - start camera
We can't just load the dataset because we need the image target ObjectTracker to create it first.
Which means we need to init the ObjectTracker.
Do we also need to "start" it? (tracker->start)
If we start it, can we later stop it, and then layer yet, start it again?
When shutting down sessions, we basically want to tear down everything except the bare minimum to keep our dataset alive.
My experience so far in trying to make this happen is that everything sort of works the first time, but when we try to fire it up for the second time (using the previously-created image target ObjectTracker), it appears to activate the dataset, but nothing gets recognized/tracked.
Anyone run up against this? We'd appreciate any thoughts/ideas.
Alternatively, is there some way we can archive or serialize the loaded dataset to disk and restore it later? - we're looking for any way to speed up this very slow load process.
We've tried a few variations on this, which