Hi, I am running a docker container on my OAK-D device and would like to add another containerized application (as it comes with conflicting dependencies).

At the moment, I have a container that includes the camera node and runs an object detection algorithm and I would like to add a second container that runs a classification algorithm on the camera output (or on the image cropped to the bounding box).

Is there a best practice to integrate depthai pipelines across docker containers?

Is it possible to forward the data over the XLinkOut interface from the first container to the XLinkIn interface of the second container?

Thanks for the help! 😄

    Hi StefanWerner
    I don't think you can run two instances of the same camera. Neither can you open an existing instance on a different process.

    I suggest either:

    • make a two stage NN pipeline, first for detection and then for classification --> will both be executed on device
    • have camera node and object detection running, but then make a bridge to a second container that will run classification of the results --> this last part will run on host.

    Thoughts?
    Jaka

    Okay, sounds reasonable, thanks a lot!

    Could you explain why this limitation applies here? I.e., why can't two docker containers share the accelerator and run pipelines on it? Would it be different if the pipelines did not share components (e.g., detection result of the first network being part of the input to the classification network) other than the camera footage?

      Hi StefanWerner
      The problem is that the device doesn't allow concurrent access. Two simultaneously running processes would have to be carefully timed not to interfere with each other and cause the device to crash. If you tried running it from different containers the message on one of them would very likely be "DEVICE ALREADY IN USE".

      Unless there is a very crafty way to emulate normal behaviour with two different dockers, but that would defeat the entire purpose of running it in separate containers.

      Thanks,
      Jaka