my code is as below:
import numpy as np
import argparse
import imutils
import time
import cv2
print(cv2.__version__)
rootPath = "E:\var\intel\vehicle-detection-0200\FP16\"
modelName = "vehicle-detection-0200" # download from intel open model zoo
irXmlFile = rootPath + modelName+".xml"
irBinFile = rootPath + modelName+".bin"
imagefile = "./vid03_023860.jpg"
COLORS = np.random.uniform(0, 255, size=(80, 3))
net = cv2.dnn.readNetFromModelOptimizer(irXmlFile, irBinFile)
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
frame = cv2.imread(imagefile)
out_blob = cv2.dnn.blobFromImage(frame, size=(672, 384))
net.setInput(out_blob)
res = net.forward()
classid_str = "classid"
probability_str = "probability"
label_str = "label"
number_top = 5
print("before, out size:", res.shape)
out = res.reshape(-1, 7)
print("after, out size:", out.shape)
count =-1
print("shape H-0:", frame.shape[0])
print("shape W-1:", frame.shape[1])
for detection in out:
count += 1
confidence = float(detection[2])
if confidence < 0.6:
break
xmin = int(detection[3] * frame.shape[1])
ymin = int(detection[4] * frame.shape[0])
xmax = int(detection[5] * frame.shape[1])
ymax = int(detection[6] * frame.shape[0])
print(count, ".confidence=", confidence, "[lx,ty,rxby]=", xmin, ymin, xmax, ymax)
if confidence > 0.5:
#cv2.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0))
cv2.rectangle(frame, (xmin, ymin), (xmax, ymax), color=COLORS[count])
cv2.imshow('OpenVINO face detection', frame)
key = cv2.waitKey(0)
If I change the model (IR files) to below model (obtaining from openvino)
squeezenet1.1.bin
squeezenet1.1.xml
Then the code can not find any bounding boxes, even the above two different model can be read with
cv2.dnn.readNetFromModelOptimizer(irXmlFile, irBinFile)
I wonder the algorithm for finding bounding boxes differs from the type of nural network, right ?
If I am correct, where can I find the algorithm for finding bounding boxes of every neural network ?