Since you are getting half a million uint32s using
a = np.fromfile(image, dtype=np.uint32)
then you will get a million uint16s using
a = np.fromfile(image, dtype=np.uint16)
There are other possibilities, however. The dtype could be any 16-bit integer dtype such as
>i2 (big-endian 16-bit signed int), or
<i2 (little-endian 16-bit signed int), or
<u2 (little-endian 16-bit unsigned int), or
>u2 (big-endian 16-bit unsigned int).
np.uint16 is the same as either <u2 or >u2 depending on the endianness of your machine.
For example,
import numpy as np
arr = np.random.randint(np.iinfo(np.uint16).max, size=(1000,1000)).astype(np.uint16)
arr.tofile('/tmp/test')
arr2 = np.fromfile('/tmp/test', dtype=np.uint32)
print(arr2.shape)
# (500000,)
arr3 = np.fromfile('/tmp/test', dtype=np.uint16)
print(arr3.shape)
# (1000000,)
Then to get an array of shape (1000, 1000), use reshape:
arr = arr.reshape(1000, 1000)
rb