I previously used https://github.com/christiansafka/img2vec 26 to create resnet50 feature vectors for each of my categories to create some statistics. Now I am noticing running the same code throws me error. I am rather much confused how to fix it as it was working and I have changed nothing (and it is the same version of PyTorch as before 0.4)
import numpy as np
from numpy import linalg as LA

infile1 = np.loadtxt('T1_resnet50_feature_vectors.txt')
infile1_reshaped = infile1.reshape(2048, 21)
cov1 = np.cov(infile1_reshaped, rowvar=False)

infile1.shape is (38, 2048)
I get error for reshaping but I need reshaping for calculating the covariance.
The code in github is using torch.
Traceback (most recent call last):
  File "feature_vectors_statistics.py", line XYZ, in <module>
    infile1_reshaped = infile1.reshape(2048, 21)
ValueError: cannot reshape array of size 77824 into shape (2048,21)

Please suggest how to calculate the covariance matrix of a file that includes feature vectors for each image in each line.