Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saving to microSD card #178

Open
CodingArcher opened this issue Aug 10, 2021 · 7 comments
Open

saving to microSD card #178

CodingArcher opened this issue Aug 10, 2021 · 7 comments
Assignees

Comments

@CodingArcher
Copy link

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

@Luxonis-Brandon
Copy link
Contributor

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.

@themarpe
Copy link
Contributor

@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

@Erol444
Copy link
Member

Erol444 commented Aug 10, 2021

This discussion on our forum: https://discuss.luxonis.com/d/275-store-video-on-oak-d-localy

@themarpe themarpe self-assigned this Sep 2, 2021
@themarpe
Copy link
Contributor

themarpe commented Dec 3, 2021

@CodingArcher
The SDcard test-app/example is ready:
luxonis/depthai-python@5449d22
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: luxonis/depthai-python#445

@alex-luxonis
Copy link
Contributor

PR description updated: luxonis/depthai-python#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

@MOj0
Copy link
Contributor

MOj0 commented Aug 14, 2022

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)

@Erol444
Copy link
Member

Erol444 commented Aug 15, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

6 participants