sfzhang15 / RefineDet

Single-Shot Refinement Neural Network for Object Detection, CVPR, 2018
Other
1.44k stars 393 forks source link

batch inference issue #191

Closed stigma0617 closed 5 years ago

stigma0617 commented 5 years ago

Hi,

I tried to infernce batch images using these lines in refinedet_demo.py

for idx, img in enumerate(im_names):
    ...
    net.blobs['data'].data[idx, :, :,:] = transformed_image

detections = net.forward()['detection_out']

for idx in range(len(im_names)):
    det_label = detection[idx, 0, :, 1] # error occurs!!

This code results in errors because the detection dimension is [1,1,#outputs, 7]

I expected the first dimension is the number of batch and tried to split each detection result per image.

What should I do to inferecne batch images?

sfzhang15 commented 5 years ago

@stigma0617 The number of batch is not the first dimension. It is the first index of the final dimension as this.

stigma0617 commented 5 years ago

@sfzhang15 thanks for your help!