Hi all,

I'm having trouble deploying a custom YOLOv6n .rvc4.tar.xz model on our Luxonis OAK4-D R2 camera using oakctl.. Despite successfully transferring the model to the camera's/data/ directory and verifying the exact file path, the app consistently fails with a file-not-found error.

What I've done:
1 . I copied the model file to the camera using:
scp yolov6n-r2-288x512.rvc4.tar.xz root@<192.168.1.118>:/data/

  1. I confirmed via ssh that the file exists:
    ssh root@<192.168.1.118>
    ls /data
    3.My Python script references the model like this:
    nn_archive = dai.NNArchive("/data/yolov6n-r2-288x512.rvc4.tar.xz")
    4.When I run: oakctl run .
    cp: cannot stat '/data/yolov6n-r2-288x512.rvc4.tar.xz': No such file or directory
    Failed to read develop logs. Reason: Error BuilderError(...)

The model is definitely present on the device and in the correct folder (/data/).
The filepath in the code matches exactly.
SSH access to the file works just fine.
The app builds successfully otherwise, but fails during the develop container startup.

Should I move the model to another directory that is guaranteed to be visible to the container?

Any help or insight would be appreciated. I'm happy to share additional information if needed!

  • Badri Pratti

    BadriPratti
    Put the model into the app folder. By default, only the app/ directory is accessible in the container mounted at /app.

    Thanks,
    Jaka

    Hi Jaka,

    Thanks so much for the quick response — I really appreciate it.

    I’m currently working out of the depthai-experiments/neural-networks/object-detection/spatial-detections directory, where I’ve modified the main.py script to load a custom .tar.xz model using dai.NNArchive. I’m confident the code changes are correct.

    Following your advice, I attempted to move my custom yolov6n-r2-288x512.rvc4.tar.xz model into the /app directory on the camera using the command:

    scp ~/Downloads/yolov6n-r2-288x512.rvc4.tar.xz root@10.127.20.109:/app/

    However, after running the command and SSHing into the camera, I wasn’t able to locate the /app directory at all. I also received the message:

    scp: /app/: Is a directory

    But when I try to ls /app, I get a "No such file or directory" error.

    Am I misunderstanding where the /app directory is mounted or how it should be used? Would appreciate any clarification on how to properly transfer the model so the container can access it.

    Thanks again for your help,
    Badri

      BadriPratti
      Not the different naming conventions I used - app/ and /app. The first one is the base directory where your app ( or the .toml file to be exact) resides - for your case -> depthai-experiments/neural-networks/object-detection/spatial-detections/ is your base app directory. When running the app, it gets containerized and all contents from base directory get copied into /app directory which is now inside your container.

      So neural-networks/object-detection/spatial-detections/media/spatial-detections.gif should translate to /app/media/spatial-detections.gif

      Thanks,
      Jaka

      So I basically put the tar.xz file in the spaital-detection folder and it means to accept it. But I am getting a different error.

      import depthai as dai

      from utils.arguments import initialize_argparser
      from utils.annotation_node import AnnotationNode

      _, args = initialize_argparser()
      model_reference: str = args.model

      visualizer = dai.RemoteConnection(httpPort=8082)
      device = dai.Device(dai.DeviceInfo(args.device)) if args.device else dai.Device()

      platform = device.getPlatform().name

      print(f"Platform: {platform}")
      nn_archive = dai.NNArchive("/app/yolov6n-r2-288x512.rvc4.tar.xz")

      frame_type = (
      dai.ImgFrame.Type.BGR888p if platform == "RVC2" else dai.ImgFrame.Type.BGR888i
      )
      with dai.Pipeline(device) as pipeline:
      available_cameras = device.getConnectedCameras()
      if len(available_cameras) < 3:
      raise ValueError("Device must have 3 cameras (color, left and right)")

      cam = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_A)
      left_cam = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
      right_cam = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
      
      stereo = pipeline.create(dai.node.StereoDepth).build(
          left=left_cam.requestOutput(nn_archive.getInputSize()),
          right=right_cam.requestOutput(nn_archive.getInputSize()),
          presetMode=dai.node.StereoDepth.PresetMode.HIGH_DETAIL,
      )
      stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A)
      if platform == "RVC2":
          stereo.setOutputSize(*nn_archive.getInputSize())
      stereo.setLeftRightCheck(True)
      stereo.setRectification(True)
      
      from depthai_nodes.node import ParsingNeuralNetwork
      nn = pipeline.create(ParsingNeuralNetwork).build(cam, nn_archive)
      
      depth_out = stereo.depth
      passthrough = nn.passthrough
      
      label_list = nn_archive.getConfig().model.heads[0].metadata.classes
      annotation_node = pipeline.create(AnnotationNode).build(
          input_detections=nn.out,
          labels=label_list,
      )
      
      visualizer.addTopic("Camera", passthrough)
      visualizer.addTopic("Detections", annotation_node.out_annotations)
      print("Pipeline created.")
      
      pipeline.start()
      visualizer.registerPipeline(pipeline)
      while pipeline.isRunning():
          key = visualizer.waitKey(1)
          if key == ord("q"):
              pipeline.stop()
              break
      print("Pipeline finished.")

      This is the code I am using to oakctl app run . after it complies successfully I want to run this offline.

      Do you know why I am getting this error.

      Best,
      Badri

        4 days later