First, I am a complete novice in deep learning and am trying out this code Bird Species Classification by Papia Nandi.
When calling out the .wav file, an error like this appears:
RuntimeError: Error opening 'PE (170).wav': System error.
and
FileNotFoundError: [Errno 2] No such file or directory: 'PE (170).wav'
There have been similar problems like this, this and this. The difference is theirs is calling the file one at a time while mine is in a for-loop. The error just happens in this for-loop execution whilst calling out the file alone before is working properly (which proves that the desired file i.e. PE (170) is indeed in the directory).
Below is the loop part and the full error message is this -> https://pastebin.com/AbES3Kcp
def get_features(df_in):
features=[]
labels = [] #empty array to store labels
#For each species, determine how many augmentations are needed
df_in=df_in.reset_index()
for i in df_in.bird_id.unique():
print('bird_id:',i)
#all the file indices with the same bird_id
filelist = df_in.loc[df_in.bird_id == i].index
for j in range(0,len(filelist)):
filename = df_in.iloc[filelist[j]].file_name
print("full path: " + os.path.abspath(filename))
#define the beginning time of the signal
tstart = df_in.iloc[filelist[j]].t_min
tend = df_in.iloc[filelist[j]].t_max #end of signal
file_name = df_in.iloc[filelist[j]].file_name
bird_id = i
songtype_id = df_in.iloc[filelist[j]].songtype_id
#Load the file
signal, sr = librosa.load(filename,sr=28000)
#cut the file to signal start and end
signal_cut=signal[int(round(tstart*sr)):int(round(tend*sr))]
#generate features & output numpy array
data = generate_features(signal)
features.append(data[np.newaxis,...])
labels.append(bird_id)
output=np.concatenate(features,axis=0)
return(np.array(output), labels)
#use get_features to calculate and store the features
test_features, test_labels = get_features(pd.concat([X_test,y_test],axis=1))
train_features, train_labels = get_features_noOS(pd.concat([X_train,y_train],axis=1))
This is my whole code. https://pastebin.com/0ucd5QRy