IndexError: list index out of range [How to Solve]

IndexError: list index out of range

When training ctpn, some pictures report this error
the error code is as follows. Because the mean value is subtracted from three channels respectively when subtracting the mean value, some pictures are of two channels, and the length does not match, so an error is reported
solution: convert to RGB three channel diagram here

    vggMeans = [122.7717, 102.9801, 115.9465] 
    imageList = cv2.split(image.astype(np.float32))
    imageList[0] = imageList[0]-vggMeans[0]  
    imageList[1] = imageList[1]-vggMeans[1]
    imageList[2] = imageList[2]-vggMeans[2]
    image = cv2.merge(imageList) 

Read More: