Matija Not sure I follow at which point to reshape the vectors, are you suggesting at some point in the output of the pipeline when leveraging NeuralNetwork()?
layers = in_nn.getAllLayers()
for layer_name in layers:
print("Layer name:", layer_name)
# get the "output" layer
output = np.array(in_nn.getLayerFp16('outputs'))
output = np.reshape(output, (8400, 7))
print(output)
boxes = output[:, :4] # get x, y, w, h
obj_scores = output[:, 4] # objectness score
class_scores = output[:, 5] # class score
class_ids = output[:, 6].astype(int) # class id
boxes_xyxy = xywh2xyxy(boxes)
# Combine [x, y, x2, y2, obj_score, class_id] as one array
detections = np.hstack((boxes_xyxy, obj_scores[:, np.newaxis], class_ids[:, np.newaxis]))
detections[:, 4] = detections[:, 4] * class_scores
total_classes = 2
boxes = non_max_suppression(detections, conf_thres=0.1, iou_thres=0.4)
#print("Shape of boxes:", boxes.shape)
boxes = np.array(boxes[0])
#print("Shape of boxes:", boxes.shape)
if boxes is not None:
frame = draw_boxes(frame, boxes, total_classes)