how can i convert gocv.Mat image data to Tensor ?
zombie-k opened this issue · comments
_Xiangqian commented
i read image use gocv.IMRead, it's a gocv.Mat, after some steps to process the gocv.Mat data, how can i convert (gocv.Mat) to (ts.Tensor) ?
sugarme commented
I don't know what kind of data gocv.Mat
is but you can create a ts.Tensor
using API ts.OfSlice(data []T)
where data is backing slice and reshape it to original shape. There also other API ts.NewTensorFromData()
where you can specify shape and dtype.
Hope that helps.
sugarme commented
close for now. If you still have issue, please provide further detail.