-
Notifications
You must be signed in to change notification settings - Fork 234
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
[BUG] Recording neural network output throws KeyError: '2_out;0_preview' #1208
Comments
Which camera, which OAK device are you using? Which version of depthai do you use? Which version of Python do you use? What does your environment look like (like which OS), are you running in a virtual-environment? |
Camera: OAK-D W PoE OV9782 Conda environment in Windows, with:
Without recording camera works properly, running the neural network with no problem. |
Without the second component recording is working:
Sorry, haven't used the SDK since quite some time now... can't remember the exact API... |
Yep, the color channel has no problem with the recording. The problems appears when the channel to be recorded is the one of the neural network. |
The xout out name of the YOLO object is "NN results". In file "depthai_sdk\recorders\video_recorder.py":
Not sure there is a "hidden" (invisble) "extra-character" added to the xout-name of the NNComponent. |
There is a loop in "depthai_sdk\record.py" to iterate over the components.
And the write() method then receives the correct names (at least what can be seen in the console), when printing the keys of the dictionary::
Without hard-coding the dict-key-instance, it throws => is there a hidden, invisible character/byte/token added? |
Looks like it's hard-coded somewhere when creating the VideoWriter (and name gets replaced at runtime after calling start(), if not set manually)... Finally, I got it working with this:
=> two video files created (first the elementary streams, then muxed into two MP4 container video files):
Something for the Luxonis-team to have a closer look into. |
(I used MS-Win11, comand-prompt (not Powershell), created a virt-env, using Python 3.12.4) Looks like the (av-)VideoWriter instance gets created under the initial xout-out name |
Cool! Many thanks. |
I have tried it and for me it works setting the encode to H265. With H264 it throws an error when closing the video. What I have seen in the recorded neural network video is that it does not contain any detection, although there are some. It looks like the raw video. I have also seen that there is some parameter that can be passed to Visualize to set a record_path, but it is not further used. It seems that this recording feature is not developed. |
How have you initially installed DepthAI? From another issue like "#1171" it looks like we are using the wrong DepthAI... I was following "https://docs-old.luxonis.com/projects/sdk/en/latest/quickstart/#installation" with @themarpe @Erol444 can you confirm we used the wrong DepthAI?? |
Hi @takgoya ,
@brmarkus , could you please contact me at [email protected]? |
Thanks for the replies. Yes, I have implemented a callback to call cv2.Videowriter in order to record. |
Following your documentation for Recording (https://docs-old.luxonis.com/projects/sdk/en/latest/quickstart/#recording), I have tried to record both the color camera and the neural network outputs.
Code is as simple as in your example:
It throws the following error:
File: "..\site-packages\depthai_sdk\recorders\video_recorder.py", line 98, in write
self._writers[name].write(frame)
KeyError: '2_out;0_preview'
It happens with any neural network, I have tried with my own customized model, and it gives the same error.
The text was updated successfully, but these errors were encountered: