libtorch-yolov3 icon indicating copy to clipboard operation
libtorch-yolov3 copied to clipboard

Libtorch batch input

Open zhjw0927 opened this issue 6 years ago • 2 comments

I have a question. In inference stage, I want to set batch to four, processing four channels of video at the same time. How should I do? Thank you !

zhjw0927 avatar Oct 09 '19 09:10 zhjw0927

Input data are supposed to be NHWC format in Pytorch, in the example, N = 1: auto img_tensor = torch::CPU(torch::kFloat32).tensorFromBlob(img_float.data, {1, input_image_size, input_image_size, 3}); So you should create a tensor with four images data, and the "write_results" function should be updated too.

walktree avatar Oct 09 '19 10:10 walktree

I'm sorry that I‘m not very clear it. Do you think I am writing this right? at::Tensor img_tensor = torch::from_blob(img1.data, img2.data, img3.data, img4.data, {1, input_image_size, input_image_size, 3}); Or, do you mind writing one for me? Thank you very much!

zhjw0927 avatar Oct 09 '19 10:10 zhjw0927