Closed InfiniteLife closed 2 years ago
Any resolution that can evenly be divided by 32 works, so that should be fine in this case. Hard to tell what the issue is, but here is what I would try:
channels_last=False
before exporting and feed the input tensors in BCHW order. Apparently I needed to convert model to half()
after loading it. I assumed libtorch loads already halfed model, as saved model was half of weights of original model, but it is wrong. Now it works.
@InfiniteLife Hello, did you convert the pt_hybrid-midas-d889a10e.pt model? Has your problem been solved? I have encountered a similar problem recently. Can I take a look at your C++ code?
I came across the same error and I just modified the order of the inputs from
torch::Tensor image_input = torch::from_blob((float*)ch_first.data, { 1, data.rows, data.cols, 3 });
to
torch::Tensor image_input = torch::from_blob((float*)ch_first.data, { 1, 3, data.rows, data.cols});
I converted model using dpt_scriptable branch, like this:
then I tried to using it in C++, loading Mat image and converting it to PyTorch:
data
height is 384 and width is 672. Infor
Im just unpacking values from OpenCV byte order to pytorch byte order.And in forward function I recieve exception:
I connected source file for debugging and got exception string:
It seems something wrong with input size? Should it be 384x384? I am not sure what is wrong