Skip to content

boxes predicted are outside of original image #14841

@LaurentBerger

Description

@LaurentBerger

opencv 4.1.-dev
I don't understand why boxes predicted are outside of original image

My program :

netFaceCaffe = cv.dnn.readNet(path+"res10_300x300_ssd_iter_140000.caffemodel",path+"deploy.prototxt")

nom_image = 'img1922.png'
img = cv.imread(nom_image)
inp = cv.dnn.blobFromImage(img,1,size=(300,300), swapRB=True)
netFaceCaffe.setInput(inp)
val_sorties = netFaceCaffe.forward()

val_sorties values are :

▶ | 000 | array([0.        , 1.        , 0.9998357 , 0.57955563, 0.33968115,        1.0533066 , 1.3527406 ], dtype=float32) | ndarray
▶ | 001 | array([0.        , 1.        , 0.996682  , 0.2517141 , 0.00525981,        0.7127846 , 0.9916738 ], dtype=float32) | ndarray
▶ | 002 | array([0.        , 1.        , 0.96443295, 2.2480547 , 2.02181   ,        2.7108996 , 2.9831972 ], dtype=float32) | ndarray
▶ | 003 | array([0.       , 1.       , 0.6320644, 2.2271295, 1.1192633, 2.7367682,        1.9990486], dtype=float32) | ndarray
▶ | 004 | array([0.        , 1.        , 0.56374866, 2.2397282 , 3.004175  ,        2.730613  , 3.8557384 ], dtype=float32) | ndarray

Values 0 and 1 are goods.
Values with index 2 (and 3). origin is outside of the image (2.24,2.02) and size is completely wrong. I don't understand

I copied image in bigger square image

img1 = np.zeros((1280,1280,3),np.uint8)
img1[0:720,0:1280]=img
inp = cv.dnn.blobFromImage(img1,1,size=(300,300), swapRB=True)
netFaceCaffe.setInput(inp)
val_sorties = netFaceCaffe.forward()

Some values are still not good but probability is low. Results:

▶ | 000 | array([ 0.0000000e+00,  1.0000000e+00,  9.9984062e-01,  2.5482580e-01,        -4.3344498e-04,  7.2584796e-01,  5.7538027e-01], dtype=float32) | ndarray
▶ | 001 | array([0.        , 1.        , 0.7884784 , 0.5762031 , 0.25832158,        1.0652127 , 0.8051507 ], dtype=float32) | ndarray
▶ | 002 | array([0.        , 1.        , 0.11816803, 0.01105985, 4.1195283 ,        0.98354244, 4.877271  ], dtype=float32) | ndarray
▶ | 003 | array([0.        , 1.        , 0.11815608, 4.0162153 , 4.119748  ,        4.985667  , 4.8753223 ], dtype=float32) | ndarray

Image is not free : I give a link to my own server

PS I found this https://stackoverflow.com/questions/47328224/error-using-data-augmentation-options-in-the-object-detection-api/47462359#47462359

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions