How to perform batch inference object detection using DNN module?

I’m currently reading single images from a directory and doing a feed forward pass through my network sequentially using the DNN module.

Please can someone provide guidance on how to perform batch inference using the DNN module?

there is not much magic there, you make a list of images and use

cv2.dnn.blobFromImages(imagelist, ...)

see docs

then you’ll receive a 4d tensor from net.forward() in the format [N,C,W,H] , where N is the batch count

@berak Thanks for your reply.

How many images can blobFromImages accept? Does it determine the optimal number of images to run through inference itself or do we need to find this ourselves somehow?

Also, is there a relation to the backend used, e.g. dnn.DNN_TARGET_CUDA_FP16?