rows = struct.unpack('>I', f.read(4))[0]
cols = struct.unpack('>I', f.read(4))[0]
images = np.frombuffer(f.read(), dtype=np.uint8, count = num * rows * cols)
rows = struct.unpack('>I', f.read(4))[0]
cols = struct.unpack('>I', f.read(4))[0]
images = np.frombuffer(f.read(), dtype=np.uint8, count = num * rows * cols)