Issue 1:
System information (version)

OpenCV => 4.1.1

Operating System / Platform => Windows 64 Bit

Compiler => Visual Studio 2017

Inference engine 2019.2.275

Detailed description

I used the version of script currently available in the master branch. My model was generated with TF 1.14 and is a ssd mobilenet v2 network. The first image is the result of the inference using the intel inference engine with the optimized version of the net. It is correct (icons should be detected) and similar to what is detected using TF. On the right, the detection using the pbtxt file with OpenCV backend (same result with IE), which is clearly wrong.

Files:

inference.zip

Steps to reproduce

python ~/opencv/samples/dnn/tf_text_graph_ssd.py --input frozen_inference_graph.pb --config pipeline.config --output graph.pbtxt

Output:

Scale: [0.050000-0.500000]

Aspect ratios: [1.0, 3.0, 10.0]

Reduce boxes in the lowest layer: True

Number of classes: 6

Number of layers: 6

box predictor: convolutional

Input image size: 800x800

Steps for getting optimized model:

python ~/openvino_2019.2.275/deployment_tools/model_optimizer/mo_tf.py --input_model frozen_inference_graph.pb --tensorflow_use_custom_operations_config ~/openvino_2019.2.275/deployment_tools/model_optimizer/extensions/front/tf/ssd_support_api_v1.14.json --tensorflow_object_detection_api_pipeline_config pipeline.config --input_shape [1,800,800,3]

Issue 2:
System information (version)

OpenCV => 3.2.0 and 4.1.2

Operating System / Platform => raspbian Linux raspberrypi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU /Linux

Compiler => gcc (Raspbian 8.3.0-6+rpi1) 8.3.0

Python 2.7.16 (default, Oct 10 2019, 22:02:15)

Python 3.7.3 (default, Apr 3 2019, 05:39:12)

cameras are IMX290

Detailed description

I have four USB cameras connected to the raspberry pi via USB.

When I run this code on python2 it succeeds but when I run it on python3 it fails.

Not sure what else to include, I'll be happy to provide more info.

Thanks

import cv2

cap1 = cv2.VideoCapture("/dev/video0")
cap2 = cv2.VideoCapture("/dev/video2")
cap3 = cv2.VideoCapture("/dev/video4")
cap4 = cv2.VideoCapture("/dev/video6")

print("cap1", cap1.read()[1][0])
print("cap2", cap2.read()[1][0])
print("cap3", cap3.read()[1][0])
print("cap4", cap4.read()[1][0])

cap1.release()
cap2.release()
cap3.release()
cap4.release()

The error message:

select timeout
VIDIOC_DQBUF: Resource temporarily unavailable
Traceback (most recent call last):
File "multiplecameratest.py", line 11, in <module>
print("cap4", cap4.read()[1][0])
TypeError: 'NoneType' object is not subscriptable

more info

pi@raspberrypi:~ $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.2.0'
>>>
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.2'
>>>

console output from fresh reboot

login as: pi
pi@'s password:
Linux raspberrypi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Dec 17 14:14:40 2019 from 192.168.1.99
pi@raspberrypi:~ $ python3 multiplecameratest.py
cap1 [[10 0 8]
[10 0 8]
[10 0 11]
...
[ 6 0 11]
[ 2 0 11]
[ 2 0 11]]
cap2 [[ 5 0 19]
[ 3 0 18]
[ 4 0 18]
...
[ 0 0 8]
[ 2 0 8]
[ 2 0 8]]
cap3 [[104 135 178]
[104 135 178]
[100 134 181]
...
[145 192 241]
[147 196 240]
[148 197 242]]
select timeout
VIDIOC_DQBUF: Resource temporarily unavailable
Traceback (most recent call last):
File "multiplecameratest.py", line 11, in <module>
print("cap4", cap4.read()[1][0])
TypeError: 'NoneType' object is not subscriptable
pi@raspberrypi:~ $ python multiplecameratest.py
('cap1', array([[106, 113, 130],
[ 99, 103, 122],
[ 97, 97, 121],
...,
[129, 78, 140],
[134, 78, 143],
[140, 79, 147]], dtype=uint8))
('cap2', array([[190, 221, 212],
[190, 219, 210],
[189, 217, 211],
...,
[117, 98, 85],
[101, 91, 74],
[ 92, 85, 66]], dtype=uint8))
('cap3', array([[141, 142, 133],
[141, 142, 133],
[141, 142, 133],
...,
[191, 191, 175],
[191, 191, 175],
[192, 192, 176]], dtype=uint8))
('cap4', array([[175, 164, 156],
[176, 165, 157],
[176, 165, 157],
...,
[131, 125, 120],
[130, 124, 119],
[130, 124, 119]], dtype=uint8))
pi@raspberrypi:~ $ python3 multiplecameratest.py
cap1 [[ 94 89 131]
[ 93 88 130]
[ 94 77 121]
...
[ 83 67 81]
[ 91 64 96]
[104 77 109]]
cap2 [[234 244 242]
[231 240 239]
[252 244 246]
...
[133 106 126]
[145 123 127]
[123 101 105]]
cap3 [[154 150 141]
[154 150 141]
[152 146 142]
...
[205 210 195]
[205 210 195]
[205 210 195]]
select timeout
VIDIOC_DQBUF: Resource temporarily unavailable
Traceback (most recent call last):
File "multiplecameratest.py", line 11, in <module>
print("cap4", cap4.read()[1][0])
TypeError: 'NoneType' object is not subscriptable
pi@raspberrypi:~ $ python multiplecameratest.py
('cap1', array([[ 82, 94, 128],
[ 75, 85, 119],
[ 70, 81, 111],
...,
[119, 95, 119],
[110, 84, 108],
[ 98, 69, 95]], dtype=uint8))
('cap2', array([[197, 226, 223],
[197, 225, 225],
[199, 225, 225],
...,
[143, 129, 133],
[127, 114, 112],
[112, 100, 96]], dtype=uint8))
('cap3', array([[142, 145, 136],
[142, 145, 136],
[142, 145, 136],
...,
[190, 194, 183],
[190, 194, 183],
[190, 194, 183]], dtype=uint8))
('cap4', array([[184, 182, 172],
[184, 182, 172],
[184, 182, 172],
...,
[150, 150, 144],
[150, 150, 144],
[150, 150, 144]], dtype=uint8))

pi@raspberrypi:~ $ ls /dev/v4l/by-path/
platform-bcm2835-codec-video-index0
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1:1.0-video-index0
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1:1.0-video-index1
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0-video-index0
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0-video-index1
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4:1.0-video-index0
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4:1.0-video-index1
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:2:1.0-video-index0
platform-fd500000.pcie-pci-0000:01:00.0-usb-0:2:1.0-video-index1

pi@raspberrypi:~ $ v4l2-ctl --all
Driver Info:
Driver name : uvcvideo
Card type : KS2A418-3.0: KS2A418-3.0
Bus info : usb-0000:01:00.0-1
Driver version : 4.19.75
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : KS2A418-3.0: KS2A418-3.0
Serial :
Bus info : 1
Media version : 4.19.75
Hardware revision: 0x00006003 (24579)
Driver version : 4.19.75
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : KS2A418-3.0: KS2A418-3.0
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x02000013: from remote pad 0x100000a of entity 'Extension 4': Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 640/480
Pixel Format : 'MJPG' (Motion-JPEG)
Field : None
Bytes per Line : 0
Size Image : 614400
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 640, Height 480
Default : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0
brightness 0x00980900 (int) : min=-64 max=64 step=1 default=4 value=80
contrast 0x00980901 (int) : min=0 max=95 step=1 default=44 value=44
saturation 0x00980902 (int) : min=0 max=100 step=1 default=58 value=58
hue 0x00980903 (int) : min=-2000 max=2000 step=1 default=0 value=0
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gamma 0x00980910 (int) : min=100 max=300 step=1 default=150 value=150
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=1 value=1
white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive
sharpness 0x0098091b (int) : min=1 max=100 step=1 default=16 value=16
backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=1 value=1
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3
exposure_absolute 0x009a0902 (int) : min=78 max=5000 step=1 default=312 value=78 flags=inactive