How to index cppflow::tensor data.
I'm trying to implement the non-max suppression algorithm on the raw output generated by the YOLOv5 model I trained and loaded into my C++ cppflow model instance.
To extract the candidate bounding boxes in python we must perform this operation
.
.
.
candidates = predictions[..., 4]
.
.
.
I did not find any way I can access the internal data of the cppflow::tensors. The only way is to extract it into an std::vector<T> using tensor.get_data<T>(). Then rearranging the dumped output into the desired shape.
I have no qualms doing this, however I do worry about the performance cost of this approach.
It would be wonderful if we could directly query the tensor object to and access the desired indeces using the [] operator. Is there no alternative approach to the one I mentioned that is less costly?
Have you tried using the cppflow::slice operator?