depthai-experiments
depthai-experiments copied to clipboard
saving to microSD card
as the POE versions have amicro SD card slot aviable it would be great to be able to make use of this due to saving large video files it is better to store locally and then download after the recording has been completed
Yes. Agreed - allowing direct storage to uSD would be super useful. We are planning to do it but do not have an ETA just yet.
@CodingArcher Access to SD card will be possible using Scripting capabilities recently released. Any data will be able to be accessed and read/written. This includes encoded H26x streams, or some any other data.
TODO for this is some firmware side changes to detect and mount the SD card
This discussion on our forum: https://discuss.luxonis.com/d/275-store-video-on-oak-d-localy
@CodingArcher
The SDcard test-app/example is ready:
https://github.com/luxonis/depthai-python/commit/5449d220e107bf36b04296126b292458d791b3dd
On depthai-python
check out the branch sdcard_support
, then run:
python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local depthai==2.13.3.0.dev0+c81c45607f1d5e0cbf08ee1ab9edf804facaa0af
python3 examples/Script/script_jpeg_to_sdcard.py
More details over at: https://github.com/luxonis/depthai-python/pull/445
PR description updated: https://github.com/luxonis/depthai-python/pull/445
- sync/unmount on clean shutdown
- rebased on the latest development
- runs on non-PoE devices, but needs a different branch for now. TODO to fix same version running on all types of devices, then we could get it merged.
Can be tested with:
- branch
sdcard_support
for PoE devices running over Ethernet:
python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local depthai==2.15.0.0.dev+c2d04a380f0fc85109bb40d74d1f84986f2aac67
- branch
sdcard_no_eth
for other devices:
python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local depthai==2.15.0.0.dev+0cd1f1c4d5fa25d473ca556dfdaf3a98c73fa960
The access to SD card is working, which is great, however when I use the ImageManip
node, I get the following error: [192.168.64.42] [163.545] [system] [critical] Fatal error. Please report to developers. Log: 'ImageManipHelper' '61'
.
I'm running the script below on --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local depthai==2.15.0.0.dev+c2d04a380f0fc85109bb40d74d1f84986f2aac67
.
import depthai as dai
import time
from pathlib import Path
nnPath = str(
(Path(__file__).parent / Path('../models/person-vehicle-bike-detection-crossroad-1016_openvino_2021.4_6shave.blob')).resolve().absolute())
pipeline = dai.Pipeline()
cam = pipeline.create(dai.node.ColorCamera)
nn = pipeline.create(dai.node.MobileNetDetectionNetwork)
manip = pipeline.create(dai.node.ImageManip) # Used to convert image to NV12 type
jpeg = pipeline.create(dai.node.VideoEncoder)
jpeg.setDefaultProfilePreset(cam.getFps(), dai.VideoEncoderProperties.Profile.MJPEG)
# Properties
cam.setPreviewSize(512, 512)
cam.setInterleaved(False)
cam.setFps(40)
# Define a neural network that will make predictions based on the source frames
nn.setBlobPath(nnPath)
nn.setConfidenceThreshold(0.5)
nn.setNumInferenceThreads(2)
nn.input.setBlocking(False)
manip.initialConfig.setResize(800, 600)
manip.initialConfig.setFrameType(dai.ImgFrame.Type.NV12) # This is required, otherwise the VideoEncoder does not work
serverScript = pipeline.create(dai.node.Script)
serverScript .setProcessor(dai.ProcessorType.LEON_CSS)
serverScript .setScript("""
# NOTE: The server code would be here but is irrelevant for this example, since there is an issue within the pipeline
""")
# Linking
cam.preview.link(nn.input)
nn.out.link(serverScript.inputs["nnDetections"])
nn.passthrough.link(manip.inputImage)
manip.out.link(jpeg.input)
jpeg.bitstream.link(serverScript.inputs['jpeg'])
# Connect to device with pipeline
with dai.Device(pipeline) as device:
while not device.isClosed():
time.sleep(1)
Hi @MOj0 ,
I believe we need to update the sdcard_support
branch to the latest main - as there were a bunch of ImageManip features introduced in newer versions of depthai (since 2.15 that sdcard_support
is based on). Once we update the branch this script should work. cc @themarpe
Thanks, Erik