• DepthAI
  • OAK-D-IoT-75 with raspberry pi.

Here are some more explanation and photos of error. As i have mentioned above it works some times too. I have found out that if I turn on my RPi (after shutting it down for sometime) the script starts working and it works fine for some time before it starts giving the error after that nothing works on RPi even the simplest scripts. I do not know why it works after resting RPi for some time. I was working on it yesterday after it started giving me the error I turned off RPi and I turned it on just now and it again worked for like an hour and then again it started giving the error and right now nothing works on RPi and the RPi is giving a pretty detailed error I have pasted its photos below. It was giving same error yesterday too. Please have a look.

  • erik replied to this.

    Hello msee19018 , Which version of the depthai library are you currently using? It looks like it's a special version from all the verbose logging.

    It is the same version that came with the prebuilt image. Its version is 2.13.3.0.dev. I have also attached the screen shoot.

    • erik replied to this.

      Hi msee19018 , Could you try updating depthai to the latest version? 2.13 is a bit old, and we might have fixed this issue already in updates.
      THanks, Erik

        Hi Erik, I updated my depthai module but it did solve the problem. It is still giving same problem. First I updated it to 2.14 version of depthai, in this case error was the one like in the image above where it says "RuntimeError: Communication exception - possible device error/misconfiguration".
        Then I updated the depthai to latest version 2.15.4.0 and it again started giving the Bus error. Here is the screen shoot from RPi.

        7 days later

        Hi msee19018 ,
        Could you please confirm the following:

        1. OAK-D IOT is powered externally with a power source
        2. OAK-D IOT is connected to the RPi with the USB 3 cable, and when running device.getUsbSpeed() it returns SUPER
        3. RPiis sufficiently powered
        4. You are using one of the code samples
        5. You are using latest preconfigured RPi OS (CM4-POE-V8.7z)
          Thanks, Erik

        Hi Erik, Yeah all of the above are correct. There is one thing that i want to tell. If I start with simple codes like rgb_preview it works fine. But when I run my own code and it starts giving above errors. After this nothing works not even the simple code samples.

        • erik replied to this.
          14 days later

          erik Hi Erik, I could not reply earlier. Here the minimum reproduceable code that crashes the device. I also explanined it a little earlier. Code has two script nodes one just arrange frames and order one post process output of NN node. Neural network is just digit recognition network. I have shared link for downloading its blob file. Please have a look. https://drive.google.com/file/d/1qYLMy7P6hGO9PQPCLKtD4_Inn-vuM2te/view?usp=sharing
          Above link is for the blob file and below link is the python code file that is pasted below.
          https://drive.google.com/file/d/1G7gWjvHbbZ_u9EWOujephRNNnN0xIvIA/view?usp=sharing

          import depthai as dai
          import numpy as np
          import marshal
          import time
          import logging 
          import os
          import requests
          
          whitelist=set('0123456789')
          time_bb_cord=[0.3070,0.6312,0.6008,0.8187]
          local_bb_cord=[0.2289,0.2812,0.3914,0.4537]
          visit_bb_cord=[0.5492,0.2762,0.7164,0.4525]
          # Create pipeline
          def Manip_Frame(pipeline,region_bb_cord):
              manip_time = pipeline.create(dai.node.ImageManip)
              manip_time.initialConfig.setCropRect(region_bb_cord[0],region_bb_cord[1],region_bb_cord[2],region_bb_cord[3])
              manip_time.setKeepAspectRatio(False)
              manip_time.initialConfig.setResize(100,32)
              return manip_time
          def NN_node(pipeline,path):
              nn = pipeline.create(dai.node.NeuralNetwork)
              nn.setBlobPath(path)
              return nn
          
          pipeline = dai.Pipeline()
          model_path = 'crnn_99_soft_no_norm_4.blob'
          
          cam = pipeline.create(dai.node.MonoCamera)
          cam.setBoardSocket(dai.CameraBoardSocket.RIGHT)
          cam.setFps(6)
          cam.setResolution(dai.MonoCameraProperties.SensorResolution.THE_800_P)
          
          
          manip_time=Manip_Frame(pipeline,time_bb_cord)
          cam.out.link(manip_time.inputImage)
          
          manip_local=Manip_Frame(pipeline,local_bb_cord)
          cam.out.link(manip_local.inputImage)
          
          manip_visit=Manip_Frame(pipeline,visit_bb_cord)
          cam.out.link(manip_visit.inputImage)
          
          script=pipeline.create(dai.node.Script)
          manip_time.out.link(script.inputs['time_frame'])
          manip_local.out.link(script.inputs['local_frame'])
          manip_visit.out.link(script.inputs['visit_frame'])
          
          script.setScript("""
          import marshal
          f_list={}
          while True:
              t_frame=node.io['time_frame'].get()
              l_frame=node.io['local_frame'].get()
              v_frame=node.io['visit_frame'].get()
              if t_frame is not None and 'time' not in f_list.keys():
                  t_f_num=t_frame.getSequenceNum()
                  f_list['time']=t_f_num
              if l_frame is not None and 'local' not in f_list.keys():
                  l_f_num=t_frame.getSequenceNum()
                  f_list['local']=l_f_num
              if v_frame is not None and 'visit' not in f_list.keys():
                  v_f_num=t_frame.getSequenceNum()
                  f_list['visit']=v_f_num
              if len(f_list.keys())==3 and f_list['time']==f_list['local'] and f_list['time']==f_list['visit']:
                  f_list.clear()
                  node.io['script_out'].send(t_frame)
                  node.io['script_out1'].send(l_frame)
                  node.io['script_out2'].send(v_frame)
          
                  """)
          
          recog_nn=NN_node(pipeline,model_path)
          
          script.outputs['script_out'].link(recog_nn.input)
          script.outputs['script_out1'].link(recog_nn.input)
          script.outputs['script_out2'].link(recog_nn.input)
          
          decoder_script=pipeline.create(dai.node.Script)
          recog_nn.out.link(decoder_script.inputs['log_probs'])
          
          decoder_script.setScript("""
          
          import marshal
          label2char={1: '0', 2: '1', 3: '2', 4: '3', 5: '4', 6: '5', 7: '6', 8: '7', 9: '8', 10: '9', 11: '.', 12: ':'}
          def get_strings(nndata):
              outname=nndata.getAllLayerNames()[0]
              data=nndata.getLayerFp16(outname)
              raw_preds=[]
              for i in range(24):
                  log_probs=data[i*13:i*13+13]
                  raw_preds.append(log_probs.index(max(log_probs)))
                  results=[]
              previous=None
              for l in raw_preds:
                  if l != previous:
                      results.append(l)
                      previous = l
              results = [l for l in results if l != 0]
              f_results=''
              for r in range(len(results)):
                  f_results=f_results+label2char[results[r]]
              return f_results
          outs=[]
          while True:
              time_=node.io['log_probs'].get()
              results=get_strings(time_)
              if len(results)==0:
                  results='none'
              if len(outs)==0:
                  outs.append(results)
              elif len(outs)>0:
                  if results=='none':
                      outs.append(results)
                  elif results!=outs[-1]:
                      outs.append(results)
              if len(outs)==3:
                  x_serial = marshal.dumps(outs)
                  b = Buffer(len(x_serial))
                  b.setData(x_serial)
                  outs.clear()
                  node.io['f_time'].send(b)
          """)
          
          nn_Out = pipeline.create(dai.node.XLinkOut)
          nn_Out.setStreamName("recogs1")
          decoder_script.outputs['f_time'].link(nn_Out.input)
          
          with dai.Device(pipeline) as device:
              nn_queue1 = device.getOutputQueue(name='recogs1', maxSize=4, blocking=False)
              while True:
                  nn_out1 = nn_queue1.get()
                  if nn_out1 is not None:
                      score_dict=marshal.loads(nn_out1.getData())
                      print(score_dict)
                          `
          • erik replied to this.

            Hello msee19018 ,
            We actually think there's a problem with the newer version of depthai or RPI OS which causes this sporadic crash. We are now investigating.
            Thanks, Erik

              erik I think there is something wrong with RPi OS because the same code works in windows and jetson nano correctly. First it was giving same errors on nano but now it works. May be there is some issue with running depthai on RPi OS. I appreciate efforts of your team, Thanks.

              • erik replied to this.

                msee19018 Yes I believe the same - either on RPI OS, or depthai in combination with RPI OS.

                3 months later

                Hi Erik, Have you guys figured out problem with RPi OS and depthai working together?

                • erik replied to this.

                  Hi msee19018 , We have fixed an issue with YOLO that was causing issues on RPI. Or is there some other issue you are referring to?

                  The problem was that same code works on OAK-D-IoT-75 when is use it with jetson nano but its does not with RPi OS. I does not matter i use your given image for OS or the one provided by raspberry pi org, program always crashes. You can see the messages above for more reference. Minimum reproduceable code is also given above.
                  Have you guys updated the given prebuilt images for RPi to run oak-d? As per our last discussion you said there is problem with RPi OS and we trying to investigate.

                  • erik replied to this.

                    Hi msee19018 ,
                    Thank you for elaborating. The script you provided surely isn't minimal, please see here on how to prepare a MRE so we can take a look at it.
                    Thanks, Erik