pytorch与tensorflow网络输入图片通道在前在后(channel_first和channel_last)

首先,Tensorflow支持图像输入通道在前和通道在后的两种模式,而Pytorch只支持通道在前的输入模式:

Tensorflow supports two form of data as the input of its convolutional layer, channels first and channels last. In the first format, data are in the form of [N, C, H, W] where N is the batch size, C is the number of channels, H is the height of matrix and W is the width of matrix. In the second format, data are in the form of [N, H, W, C]. In PyTorch only channels first data format is supported.

在Tensorflow中可以设置进行两种模式的切换与选择,而在Pytorch中,如果是通道在后的话,就只能够对输入进行变换,可以参考:https://blog.csdn.net/qq_40877238/article/details/106024442

上一篇:危险系数---Python练习


下一篇:conda创建环境速度慢解决方法