Solved by Nikronic in post #4 
              
              
                It seems your code is unable to read image. Can you make sure you are doing it correctly by printing type of image in this line: 

By they way, if you are not going to do any specific preprocessing using cv2, I think it is better idea to load your images using Pillow which is the default image proce…