#NEWLINE# def read_images_from( path = Data_PATH ) : #NEWLINE# #INDENT# images = [ ] #NEWLINE# png_files_path = glob . glob ( os . path . join ( path , 'train/' , '*.[pP][nN][gG]' ) ) #NEWLINE# for filename in png_files_path : #NEWLINE# #INDENT# im = Image . open ( filename ) #NEWLINE# im = np . asarray ( im , np . uint8 ) #NEWLINE# image_name = filename . split ( '/' ) [ ( - 1 ) ] . split ( '.' ) [ 0 ] #NEWLINE# images . append ( [ int ( image_name ) , im ] ) #NEWLINE# #UNINDENT# images = sorted ( images , key = ( lambda image : image [ 0 ] ) ) #NEWLINE# images_only = [ np . asarray ( image [ 1 ] , np . uint8 ) for image in images ] #NEWLINE# images_only = np . array ( images_only ) #NEWLINE# print ( images_only . shape ) #NEWLINE# return image