load dataset using glob and how to see what comes out
I am trying to create a dataset that can be used for training a ML model (CNN), but I am having trouble reading the files (have I used glob correct) and sorting them in a way that is useful for training. I am not sure what comes out of this when i run load_data. (Dataset an code comes from kaggle) The code is written in jupyter notebook. I intend to use pytorch on this dataset.
Here is the code I have got so far:
emotions={
  '01':'neutral',
  '02':'calm',
  '03':'happy',
  '04':'sad',
  '05':'angry',
  '06':'fearful',
  '07':'disgust',
  '08':'surprised'
}
#DataFlair - Emotions to observe
observed_emotions=['neutral', 'happy', 'sad', 'angry']
# os.listdir(&quot;../input&quot;)


def extract_feature(emo_file, mfcc):
    with soundfile.SoundFile(emo_file) as emo_file:
         X, sr = librosa.load(emo_file, sr=22050, mono=True, offset=1.0, duration=2.0)
         # X = sound_file.read(dtype=&quot;float32&quot;)
         # sample_rate=sound_file.samplerate
         mfccs = np.mean(librosa.feature.mfcc(y=X, sr=sr, n_mfcc=40).T, axis=0)
         result = np.hstack((mfccs))
         return result


def load_data(test_size=0.2): # hold back 20% as test-set
    x,y=[],[]
    #for file in glob.glob('/Users/.../NeuralNetworks/SER_dataset'):
    for file in glob.glob('/Users/.../NeuralNetworks/SER_dataset/Actor*/*'):
        emo_file=os.path.basename(file)

        plt.figure(figsize=(18, 3))  # plot using librosa
        matplotlib.waveplot(y, sr=sr)
        plt.ylim([-0.1, 0.1])

        emotion=emotions[emo_file.split(&quot;-&quot;)[2]] #load file based on label
        if emotion not in observed_emotions:
            continue
        feature=extract_feature(emo_file, mfcc=True)
        x.append(feature)
        y.append(emotion)
    return train_test_split(np.ndarray(x), y, test_size=test_size, random_state=9)


numpy_dataset = load_data
print(np.ndarray.shape(numpy_dataset))

Here´s the error message that I get:
TypeError                                 Traceback (most recent call last)
Input In [127], in &lt;cell line: 2&gt;()
      1 numpy_dataset = load_data
----&gt; 2 print(np.ndarray.shape(numpy_dataset))

TypeError: 'getset_descriptor' object is not callable

If you also can give me some advise on how to make this dataset trainable with pytorch it would be amazing. (turn it into a tensor)
Here´s my suggestion:
emo_dataset = torch.from_numpy(numpy_dataset)


numpy_dataset = load_data
print(np.ndarray.shape(numpy_dataset))


Here´s the error message that I get:
... 'getset_descriptor' object is not callable

Yup, that makes sense.
You assigned a function's definition to the dataset,
rather than assigning the function's result.
You want to actually call that function
numpy_dataset = load_data()

before trying any .shape() queries.
Asking for the shape of the function's bytecode
won't elicit anything useful.
