深度学习学习7步骤_如何通过4个简单步骤为深度学习标记音频
深度學習學習7步驟
In order to train Deep Learning models, preparing and curating datasets is usually a very important step. In this story, I show how you can use Audacity a “free, open-source, cross-platform audio software” to label your data.
為了訓練深度學習模型,準備和整理數據集通常是非常重要的一步。 在這個故事中,我將向您展示如何使用Audacity這個“免費,開源,跨平臺的音頻軟件”來標記數據。
表中的內容 (Table of content)
- Spectrogram Representation 頻譜圖表示
- Creating Labels 創建標簽
- Exporting Labels 導出標簽
- Loading Data on Python 在Python上加載數據
1.頻譜圖表示 (1. Spectrogram Representation)
The first step, right after installing Audacity and importing an audio file, is to change to spectrogram representation as shown in the image below.
在安裝Audacity并導入音頻文件之后,第一步就是更改為頻譜圖表示形式 ,如下圖所示。
Viewing the spectrogram in Audacity. Print screen by the author.在Audacity中查看頻譜圖。 由作者打印屏幕。You can then adjust the spectrogram settings in the same menu and the scale of visualization by right-clicking on the scale. In the example below, I’m selecting “Mel” option for the scale. You can read more about the meaning of Mel Spectrograms in this story by Dalya Gartzman.
然后,您可以在同一菜單中調整頻譜圖設置,并通過右鍵單擊刻度來調整可視化的刻度。 在下面的示例中,我為秤選擇“ Mel”選項。 您可以在Dalya Gartzman的 故事中了解有關梅爾譜圖的含義的更多信息。
Changing the scale to Mel. Image by the author.將音階更改為Mel。 圖片由作者提供。2.創建標簽 (2. Creating Labels)
To create the labels first go Edit > Labels > Add Label at Selection and check the keyboard shortcut (Ctrl+B in Windows) so that you don’t need to go back to the menu every time.
要創建標簽,請首先進入“ 編輯”>“標簽”>“在選擇時添加標簽”,然后檢查鍵盤快捷鍵(在Windows中為Ctrl + B),這樣就無需每次都返回菜單。
Finding the option to add a label. Image by the author.查找添加標簽的選項。 圖片由作者提供。Now that you know the keyboard shortcut select a region in the spectrogram that you want to label (click and drag) and then use the shortcut to ‘Add Label at Selection’. A label track will appear and you can type the name for your label. You can repeat this process to add as many labels as needed!
現在您已經知道鍵盤快捷鍵,在頻譜圖中選擇要標記的區域(單擊并拖動),然后使用該快捷方式“在選擇時添加標簽”。 標簽軌道將出現,您可以鍵入標簽的名稱。 您可以重復此過程以根據需要添加盡可能多的標簽!
Creating the labels. Image by the author.創建標簽。 圖片由作者提供。Note: It helps to play the clip as you are labelling. You can use the ‘space bar’ to play and pause.
注意:在貼標簽時播放片段會有所幫助。 您可以使用“空格鍵”播放和暫停。
3.導出標簽 (3. Exporting Labels)
To export the labels, go to File > Export > Export Labels.
要導出標簽,請轉到文件>導出>導出標簽。
Exporting the labels. Image by the author.導出標簽。 圖片由作者提供。The result is a text file with each label indicating the start and end time, name of the label, and minimum and maximum frequency. A value of -1 in the frequency indicates lower than the minimum or higher than the maximum displayed.
結果是一個文本文件,每個標簽指示開始和結束時間,標簽名稱以及最小和最大頻率。 頻率值-1表示低于顯示的最小值或高于顯示的最大值。
Example of exported labels. Image by the author.導出標簽的示例。 圖片由作者提供。4.在Python上加載數據 (4. Loading Data on Python)
After repeating the steps above for all audio files you are ready to load the data in Python! I prepared the following code to read and display a spectrogram with the respective labels. The code is also available as a Kaggle kernel.
對所有音頻文件重復上述步驟之后,您就可以在Python中加載數據了! 我準備了以下代碼,以讀取和顯示帶有相應標簽的頻譜圖。 該代碼也可以作為Kaggle內核使用 。
The result is the following image of the Mel Spectrogram with the red bounding boxes corresponding to the labels in the ‘labels dataframe’ (code above).
結果是梅爾頻譜圖的以下圖像,其中紅色邊框與“標簽數據框”(上面的代碼)中的標簽相對應。
Mel spectrogram and labels. Image by the author.梅爾光譜圖和標簽。 圖片由作者提供。結束語 (Final remarks)
I hope you find this story useful! Please consider joining my private mailing list in this link so that you won’t miss any of my following stories! You can read more about my Data Science journey in the following two stories!
我希望您覺得這個故事有用! 請考慮通過此鏈接加入我的私人郵件列表 這樣您就不會錯過我的以下任何故事! 您可以通過以下兩個故事閱讀有關我的數據科學之旅的更多信息!
Thanks for reading! Have a great day!
謝謝閱讀! 祝你有美好的一天!
翻譯自: https://towardsdatascience.com/how-to-label-audio-for-deep-learning-in-4-simple-steps-6a2c33b343e6
深度學習學習7步驟
總結
以上是生活随笔為你收集整理的深度学习学习7步骤_如何通过4个简单步骤为深度学习标记音频的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: S12蜘蛛大乱斗出装 加点怎么加
- 下一篇: S12塞恩大乱斗怎么玩 2022老司机怎