Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

one of your images is invalid. please DON'T do this:

images.append(cv2.imread(path, 0))

imread() may fail silently, and return None,you absolutely HAVE TO CHECK (and python users never do ...) like:

im = cv2.imread(path, 0)
if im == None:
    continue
images.append(im)

one of your train images is invalid. please DON'T do this:

images.append(cv2.imread(path, 0))

imread() may fail silently, and return None,you absolutely HAVE TO CHECK (and python users never do ...) like:

im = cv2.imread(path, 0)
if im == None:
    continue
images.append(im)

one of your train images is invalid. please DON'T do this:

images.append(cv2.imread(path, 0))

imread() may fail silently, and return None,you absolutely HAVE TO CHECK (and python users never do ...) like:

im = cv2.imread(path, 0)
if im == None:
None: # wrong path ?
    continue
images.append(im)

one of your train images is invalid. please DON'T do this:

images.append(cv2.imread(path, 0))

imread() may fail silently, and return None,you absolutely HAVE TO CHECK (and python users never do ...) like:

im = cv2.imread(path, 0)
if im == None: # wrong path ? not an image ?
    continue
images.append(im)