dmjeong
dmjeong

Reputation: 121

python 3.7 numpy load ValueError: cannot reshape array of size 5218288 into shape (1974,3,128,128,3)

Traceback (most recent call last):
  File "3dagn.py", line 468, in <module>
    hybrid_network()
  File "3dagn.py", line 107, in hybrid_network
    appx = np.load('file.npy')
  File "/home/dmjeong/anaconda3/envs/fer/lib/python3.7/site-packages/numpy/lib/npyio.py", line 440, in load
    pickle_kwargs=pickle_kwargs)
  File "/home/dmjeong/anaconda3/envs/fer/lib/python3.7/site-packages/numpy/lib/format.py", line 734, in read_array
    array.shape = shape
ValueError: cannot reshape array of size 5218288 into shape (1974,3,128,128,3)

Hi, I just wanna load npy file as usual. but this error occur for the first time.... I have no idea about this error here's the code

appx = np.load('mmi_app_x.npy')

other npy files are opened with that code without any error. i don't know 5218288 meaning. do you have any idea?

Upvotes: 8

Views: 9635

Answers (2)

DevLoverUmar
DevLoverUmar

Reputation: 14011

I reshaped my numpy array to lower dimensions; from (10, 30, 224, 224, 3) to (300, 224, 224, 3). Then I used another scp tool, as highlighted by @ankit shukla, to transfer .npy from high performance cluster (HPC) to my local PC and it worked.

Upvotes: 0

ankit shukla
ankit shukla

Reputation: 357

It probably would be because of a damaged numpy file. In my case the file wasn't transferred correctly between servers. Re-transferring it solved the issue.

Upvotes: 20

Related Questions