jakaskerl
Ok thank you for the tip.
So I got the error "No eMMC memory available".
I tried to add eMMC configuration inside my script by adding :
# Set board config
board = dai.BoardConfig()
board.emmc = True
config = dai.Device.Config()
config.board = board
pipeline.setBoardConfig(board)
So my script is like this :
#!/usr/bin/env python3
from pathlib import Path
import cv2
import depthai as dai
import numpy as np
import time
import argparse
labelMap = ["background", "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow",
"diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]
nnPathDefault = str((Path(__file__).parent / Path('../models/mobilenet-ssd_openvino_2021.4_6shave.blob')).resolve().absolute())
parser = argparse.ArgumentParser()
parser.add_argument('nnPath', nargs='?', help="Path to mobilenet detection network blob", default=nnPathDefault)
parser.add_argument('-ff', '--full_frame', action="store_true", help="Perform tracking on full RGB frame", default=False)
args = parser.parse_args()
fullFrameTracking = args.full_frame
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and outputs
camRgb = pipeline.create(dai.node.ColorCamera)
detectionNetwork = pipeline.create(dai.node.MobileNetDetectionNetwork)
objectTracker = pipeline.create(dai.node.ObjectTracker)
xlinkOut = pipeline.create(dai.node.XLinkOut)
trackerOut = pipeline.create(dai.node.XLinkOut)
xlinkOut.setStreamName("preview")
trackerOut.setStreamName("tracklets")
# Properties
camRgb.setPreviewSize(300, 300)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
camRgb.setInterleaved(False)
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR)
camRgb.setFps(40)
# testing MobileNet DetectionNetwork
detectionNetwork.setBlobPath(args.nnPath)
detectionNetwork.setConfidenceThreshold(0.5)
detectionNetwork.input.setBlocking(False)
objectTracker.setDetectionLabelsToTrack([15,7]) # track only person
# possible tracking types: ZERO_TERM_COLOR_HISTOGRAM, ZERO_TERM_IMAGELESS, SHORT_TERM_IMAGELESS, SHORT_TERM_KCF
objectTracker.setTrackerType(dai.TrackerType.ZERO_TERM_COLOR_HISTOGRAM)
# take the smallest ID when new object is tracked, possible options: SMALLEST_ID, UNIQUE_ID
objectTracker.setTrackerIdAssignmentPolicy(dai.TrackerIdAssignmentPolicy.SMALLEST_ID)
# Linking
camRgb.preview.link(detectionNetwork.input)
objectTracker.passthroughTrackerFrame.link(xlinkOut.input)
if fullFrameTracking:
camRgb.video.link(objectTracker.inputTrackerFrame)
else:
detectionNetwork.passthrough.link(objectTracker.inputTrackerFrame)
detectionNetwork.passthrough.link(objectTracker.inputDetectionFrame)
detectionNetwork.out.link(objectTracker.inputDetections)
objectTracker.out.link(trackerOut.input)
# Set board config
board = dai.BoardConfig()
board.emmc = True
config = dai.Device.Config()
config.board = board
pipeline.setBoardConfig(board)
(f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
bootloader = dai.DeviceBootloader(bl)
progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
(r, errmsg) = bootloader.flash(progress, pipeline, memory=dai.DeviceBootloader.Memory.EMMC)
if r: print("Flash OK")
else : print(errmsg)
But I got the same error. I think the board I use (OAK-FFC 4P) has no eMMC.
I couldn't find it mentioned in the docs and I tried to checked the bootloader version I got this and I can not see eMMC informations :
Found device with name: 1.1.2
Version: 0.0.27
USB Bootloader - supports only Flash memory
Memory 'Memory.FLASH' size: 33554432, info: JEDEC ID: 20 BB 19
But I don't understand why I am able to flash this script :
#!/usr/bin/env python3
'''
NOTE: This should only be run on OAK-FFC-4P, as other OAK cameras might have different GPIO configuration!
'''
import depthai as dai
import time
# Start defining a pipeline
pipeline = dai.Pipeline()
script = pipeline.create(dai.node.Script)
script.setScript("""
import serial
import time
ser = serial.Serial("/dev/ttyS0", baudrate=115200)
i = 0
while True:
i += 1
time.sleep(0.1)
serString = f'TEST_{i}'
ser.write(serString.encode())
""")
# Define script for output
script.setProcessor(dai.ProcessorType.LEON_CSS)
config = dai.Device.Config()
# Get argument first
GPIO = dai.BoardConfig.GPIO
config.board.gpio[15] = GPIO(GPIO.OUTPUT, GPIO.ALT_MODE_2)
config.board.gpio[16] = GPIO(GPIO.INPUT, GPIO.ALT_MODE_2)
config.board.uart[0] = dai.BoardConfig.UART()
pipeline.setBoardConfig(config.board) # set the config to pipeline object
# Flash the pipeline
(f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
bootloader = dai.DeviceBootloader(bl)
progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
bootloader.flash(progress, pipeline)
And not the object-tracker one.