Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created July 10, 2019 07:23
Show Gist options
  • Save aravindpai/b63cf79740bb8f138ad629ba3fa5fc38 to your computer and use it in GitHub Desktop.
Save aravindpai/b63cf79740bb8f138ad629ba3fa5fc38 to your computer and use it in GitHub Desktop.
labels=os.listdir(train_audio_path)
#find count of each label and plot bar graph
no_of_recordings=[]
for label in labels:
waves = [f for f in os.listdir(train_audio_path + '/'+ label) if f.endswith('.wav')]
no_of_recordings.append(len(waves))
#plot
plt.figure(figsize=(30,5))
index = np.arange(len(labels))
plt.bar(index, no_of_recordings)
plt.xlabel('Commands', fontsize=12)
plt.ylabel('No of recordings', fontsize=12)
plt.xticks(index, labels, fontsize=15, rotation=60)
plt.title('No. of recordings for each command')
plt.show()
labels=["yes", "no", "up", "down", "left", "right", "on", "off", "stop", "go"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment