Topic locked

How to preload image targets - slow load time

July 27, 2021 - 10:04pm #5

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:

Quote:

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.

Thanks!!

 

We've tried a few variations on this, which 

How to preload image targets - slow load time

July 29, 2021 - 10:36am #4

Hello,

I've escalated the issue regarding activated datasets not recognizing targets for internal review.

Wanted to take this as another opportunity to advertise the availability of Vuforia Engine 10, which introduces a brand-new API for faster and easier development.

Thanks,

Vuforia Engine Support

How to preload image targets - slow load time

August 6, 2021 - 5:59am #3

Hey there,

Sorry for the delay in response. Please bare with me while I am trying to understand the issue. As far as I understand there are two questions:

1. How can we speed up the process of loading a large database of images?

2. Can we preload datasets before your user opens up their camera?

I'd like to organize the questions so I can provide you with a good answer. Let me know if these are the right questions you currently have, or if there are more!

How to preload image targets - slow load time

August 11, 2021 - 1:06pm #2

Yes, those are the questions.  I don't think we can load any FASTER, but I want to be able to load all of my image targets early on when the app starts, so that when the user opens our live camera (vuforia) view, it is ready-to-go.

How to preload image targets - slow load time

August 23, 2021 - 8:16am #1

Hey there,

 

Sorry for the delayed response, again. Some people internally are on holiday which makes it hard to get a good answer for you. As far as I know you can initialize Vuforia and, on a background thread, perform all the steps that you listed up to “load and activate the relevant dataset”. Then when it is time to start the AR part of your app (on the UI thread) you can then do the rest of the steps. When switching away from the AR you should be able to stop the camera and the tracker but leave the tracker initialized and dataset loaded.

I hope that helps a little... If there's any issue along the way, let me know, and I can see what I can do.

Thanks!

 

Kind regards,

Patrick Scheper

Technical Community Manager

Topic locked