alliedvision / VimbaPython

Old Allied Vision Vimba Python API. The successor to this API is VmbPy
BSD 2-Clause "Simplified" License
93 stars 40 forks source link

Receiving incomplete frames during multithreding with 2 cameras #169

Closed Enot3811 closed 1 year ago

Enot3811 commented 1 year ago

Hello. I was thinking of using 2 gige mako cameras for my research project, but I got stuck when I tried to get frames from 2 cameras to acquire frames from 2 cameras simultaneously. I would appreciate your help.

I'm using the VimbaPython api and related examples. When running the multithreading_opencv.py script, only one camera sends completed frames and streams well, while the other camera only sends incomplete frames. I could figure it out by running the asynchronous_grab.py script in 2 terminals for 2 cameras simultaneously. It seems that one camera is crowding out the other. Then i tried to adjust some options in the VimbaViewer. Lowering the resolution or a very small fixed frequency helps, but it seems like not a very good solution.

Cameras that i used: 1) Mako G-508B POL 2) Mako G-507C

System: Ubuntu 20.04 PC: Intel Core i9-12900k NVidia GeForce 3090 ti 64 GB RAM

The cameras are connected via a network hub with a supported speed of up to 1000 Mb.

In addition to the computer, I tried to connect cameras to an arm64 board. Unfortunately, I can't name this board right now, but it was something like NVidia Jetson. There was another problem on the board, but it seems to me that it has a similar cause. There, even one camera could not stream in full resolution, not to mention two at the same time. The camera sent incomplete frames almost all the time and very rarely complete ones. It looks like the board is not processing received frames in time or some kind of problem with the ethernet port, but I do not fully understand what the appearance of incomplete frames generally means.

All used code is the unmodified source code from the VimbaPython examples https://github.com/alliedvision/VimbaPython/tree/master/Examples

BernardoLuck commented 1 year ago

Hello,

the incomplete frame appear because the cameras are trying to use all the max bandwidth available, that means the 1000Mbps. That means, the switch is trying to send 2000Mbps to the PC. This is not possible. You need to limit the bandwidth of each camera to the half, this means to 62'000'000. This will reduce the bandwidth, which leads to lower FPS for each camera, but guarantees the correct transmission of the GigE packages.

If you have more questions, do not hesitate to send an email to support@alliedvision.com

Enot3811 commented 1 year ago

Thanks. It helps on the PC but not on the board. I will try to send an email to the support.

BernardoLuck commented 1 year ago

Hello, the performance of the network card on the jetson SoM differs from SoM to SoM. It is not same using a Jetson Nano or a Jetson Orin. On this case, I suggest to reduce the bandwidth until you get no incomplete frames. Furthermore, I recommend you to read the recommendations for optimizing the performance on Jetson SoMs: https://cdn.alliedvision.com/fileadmin/content/documents/products/software/software/embedded/Optimizing-Performance-Jetson_appnote.pdf