Pytorch测试正常,RT测试不一致,分析了一下,主要是数据的问题导致的差异,记录一下自己的踩坑
1:Pytorch数据:格式-NCHW, 通道顺序-RGB,数值范围-[0-1], 数据类型-float
"""
Convert a ``PIL Image`` or ``numpy.ndarray`` to tensor.
Converts a PIL Image or numpy.ndarray (H x W x C) in the range
[0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0].
"""
一般会碰到PIL或者cv2的使用接口:两者的差异
PIL :RGB, 0~1, CHW
numpy:BGR, 0~255,HWC
2:opencv数据:格式-HWC, 通道顺序-BGR,数值范围-[0-255], 数据类型-uchar