при передаче большого двоичного объекта из сети, получающего массив обнаружения 2-го уровня, но ожидающего массив обнаружения 3-го уровня - PullRequest
0 голосов
/ 13 июня 2019
While passing blob from the network i am getting detection of (1,512) but it should be three dimension. 
# construct a blob from the frame, pass it through the network,
# obtain our output predictions, and initialize the list of
# bounding box rectangles
# frame size is (888, 500, 3)
#blob shape is (1,3,112,96)
#detection shape is (1, 512) 
#code

    blob = cv2.dnn.blobFromImage(frame, 1.0, (96, 112),
    (104, 117, 123),swapRB=True, crop=False )
    print(blob.shape)
    net.setInput(blob)
    detections = net.forward()
    print(detections.shape)
    rects = []
    for i in range(0, detections.shape[2]):
        if detections[0, 0, i, 2] > 0.5:
            box = detections[0, 0, i, 3:7] * np.array([W, H, W, H])
            rects.append(box.astype("int"))
            (startX, startY, endX, endY) = box.astype("int")
            cv2.rectangle(frame, (startX, startY), (endX, endY),
            (0, 255, 0), 2)

Ошибка

IndexError Traceback (последний последний вызов)

in ()

IndexError: индекс кортежа вне диапазона

Я ожидаю, что форма обнаружения должна быть трехмерной, поэтому я не получу эту ошибку.

...