How can I switch between two different models? That is, an application runs for some time using blob A, then at some point, it decides to switch to blob B. The crudest method is to reboot. Short of that, there could be some linux command to disconnect and reconnect the USB hosting the OAK? Or within DepthAI perhaps use unlink() and remove() to depopulate the pipeline, and then repopulate and use setBlobPath() with a different model?

I feel like this has already been answered in another thread and I couldn't find it.

    Thanks for the pointer @jakaskerl ! It wasn't clear to me from the script example whether or not the blob could be changed (reloaded). I did some experiments to learn more about how things work with DepthAI in my app.

    1. I replaced "with dai.Device(pipeline) as device:" by two lines: device = dai.Device(pipeline) device.startPipeline()which does work

    2. Then later, I tried a few other things: print("is pipeline running =",device.isPipelineRunning())

      device.close()

      print("closed =",device.isClosed()) and this sequence also works as expected.

    3. Then I tried print(pipeline.serializeToJson()) which generates huge output, but interesting to see all the parameters that might be useful in future debugging/design.

    4. The pipeline.serializeToJson() generates a segfault after device.close(), which I guess means the pipeline is destroyed after the device is closed.

    5. Based on these experiments, a different plan (which I will test at some point) is to close the device, then rebuild a new pipeline with a different blob, and start that. If this works, there will likely be a couple second delay for the time to upload the new blob.


      TedHerman
      The idea is to load both blobs in separate NeuralNetworks. Then use script node to send frames either to first or the second one.

      Thanks,
      Jaka