1. View through python
from PIL import Image
img=Image.open('E:/Apple/test/test_label/t_11.png')
# 直接就输出图像的通道数了
print(len(img.split()))
If the output result is 1, it is a single channel
2. View through the image properties
In the detailed information of the image, if the bit depth of the image is 8, it is a single channel (grayscale image), if the bit depth is 24, it is three channels, and if the bit depth is 32, it is four channels.