I am having the strangest issue.
It seems to involve number the number of lines on top?
This:
from depthai_sdk import OakCamera
from depthai_sdk.classes import TwoStagePacket
import threading
import re
import depthai as dai
pattern = r"\b[A-Z0-9]{5,7}\b"
chars = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
last_text = ''
with OakCamera(usb_speed=dai.UsbSpeed.SUPER) as oak:
color = oak.create_camera('color', )
color.config_color_camera(effect_mode=dai.CameraControl.EffectMode.MONO)
det = oak.create_nn(name='det', model='face-detection-retail-0004', input=color)
det.config_nn(resize_mode='crop')
rec = oak.create_nn(name='rec', model='./models/ocr.json', input=det)
rec.config_multistage_nn(debug=True)
def add_and_display():
while True:
#show_message(device, last_text, fill="white", font=proportional(LCD_FONT) )
return
def cb(packet):
return
t = threading.Thread(target = add_and_display)
t.daemon = True
t.start()
oak.visualize(det, callback=cb)
oak.visualize(det.out.passthrough, fps=True)
oak.start(blocking=True)
Causes this:
[184430101176431300] [2.1] [2.973] [DetectionNetwork(2)] [info] Needed resources: shaves: 6, ddr: 4458752
[184430101176431300] [2.1] [2.975] [DetectionNetwork(1)] [info] Needed resources: shaves: 6, ddr: 2728832
[184430101176431300] [2.1] [2.988] [DetectionNetwork(2)] [info] Inference thread count: 2, number of shaves allocated per thread: 6, number of Neural Compute Engines (NCE) allocated per thread: 1
[184430101176431300] [2.1] [4.469] [system] [critical] Fatal error. Please report to developers. Log: 'Fatal error on MSS CPU: trap: 00, address: 00000000' '0'
←[31mF: [global] [ 0] [ThreadN] dispatcherResponseServe:925 no request for this response: XLINK_WRITE_RESP 1
←[0m
[2023-06-05 02:46:39.663] [debug] DataOutputQueue (0_preview) closed
[2023-06-05 02:46:39.663] [debug] DataOutputQueue (det_passthrough) closed
[2023-06-05 02:46:39.663] [debug] DataOutputQueue (det_out) closed
[2023-06-05 02:46:39.663] [debug] Timesync thread exception caught: Couldn't read data from stream: '__timesync' (X_LINK_ERROR)
[2023-06-05 02:46:39.663] [debug] Log thread exception caught: Couldn't read data from stream: '__log' (X_LINK_ERROR)
[2023-06-05 02:46:39.924] [debug] Watchdog thread exception caught: Couldn't write data to stream: '__watchdog' (X_LINK_ERROR)
Closing OAK camera
[2023-06-05 02:46:39.940] [debug] Device about to be closed...
[2023-06-05 02:46:39.940] [debug] XLinkResetRemoteTimeout returned: X_LINK_ERROR
[2023-06-05 02:46:39.950] [debug] XLinkResetRemote of linkId: (0)
[2023-06-05 02:46:41.350] [debug] Device closed, 1410
BUT, if I add one empty line under the imports:
from depthai_sdk import OakCamera
from depthai_sdk.classes import TwoStagePacket
import threading
import re
import depthai as dai
pattern = r"\b[A-Z0-9]{5,7}\b"
chars = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
last_text = ''
with OakCamera(usb_speed=dai.UsbSpeed.SUPER) as oak:
color = oak.create_camera('color', )
color.config_color_camera(effect_mode=dai.CameraControl.EffectMode.MONO)
det = oak.create_nn(name='det', model='face-detection-retail-0004', input=color)
det.config_nn(resize_mode='crop')
rec = oak.create_nn(name='rec', model='./models/ocr.json', input=det)
rec.config_multistage_nn(debug=True)
def add_and_display():
while True:
#show_message(device, last_text, fill="white", font=proportional(LCD_FONT) )
return
def cb(packet):
return
t = threading.Thread(target = add_and_display)
t.daemon = True
t.start()
oak.visualize(det, callback=cb)
oak.visualize(det.out.passthrough, fps=True)
oak.start(blocking=True)
[184430101176431300] [2.1] [3.205] [DetectionNetwork(2)] [info] Needed resources: shaves: 6, ddr: 4458752
[184430101176431300] [2.1] [3.207] [DetectionNetwork(1)] [info] Needed resources: shaves: 6, ddr: 2728832
[184430101176431300] [2.1] [3.220] [DetectionNetwork(2)] [info] Inference thread count: 2, number of shaves allocated per thread: 6, number of Neural Compute Engines (NCE) allocated per thread: 1
[184430101176431300] [2.1] [3.220] [DetectionNetwork(1)] [info] Inference thread count: 2, number of shaves allocated per thread: 6, number of Neural Compute Engines (NCE) allocated per thread: 1
[184430101176431300] [2.1] [3.548] [Script(5)] [warning] New msg frames, seq 0
[184430101176431300] [2.1] [3.548] [Script(5)] [warning] New msg detections, seq 0
[184430101176431300] [2.1] [3.549] [Script(5)] [warning] synced 0. Removed older sync values. len 0
[184430101176431300] [2.1] [3.552] [Script(5)] [warning] New msg frames, seq 1
[184430101176431300] [2.1] [3.552] [Script(5)] [warning] New msg detections, seq 1
It's not just me, right? There is something very strange about this. It only does this when I use at least one of my own custom models. This was driving me nuts until I figured out I had to add an extra line on top cause things were crashing for no reason.
Also, I really hate your discussion editor. Is there a trick to getting it to deal with pasting as code and then exiting the code box cause I can't figure it out -- I have to use three ` and add an extra line and then go back and past into the code box otherwise I am stuck in the code box with no way to add normal text.