導入 科学者は、大規模な生態系を研究するために自動化されたシステムを使用しています。 この情報は、特定の環境内の種の分布をよりよく理解するために使用することができる動物や昆虫の異なる種の識別に役立つために使用できるオーディオを録音するために使用されます。 「生態学者は、鳥類を用いて食料システムや森林の健康を理解する――例えば、森林に木を採る人が多いということは、死んだ木がたくさんあることを意味する」さらに、彼らはオーディオベースの識別の価値を指摘する:「鳥類は、歌や呼びかけで領土を伝達し、識別するので、耳で識別することが最も効率的です。 autonomous recording units (ARUs) Birdsong in the Wild for Classification(野生の鳥の歌) Birdsong in the Wild for Classification(野生の鳥の歌) 最近、The 競争開始中 雨傘の下で、 ImageCLEFは、さまざまな分野におけるクロス言語の注釈と画像の取得の調査を支援します。コンテストの目的は、オーディオ録音から鳥の種を正確に予測できる分類モデルを設計することです。 バードクリーフ+2025 Kaggle イラスト バードクリーフ+2025 イラスト 最初に、このタスクは、その利用可能性を考慮して、微妙なもののように見えます。 , also known as GBV分類は約11000種の鳥類に訓練されており、分類モデルとして明らかな選択肢である。 Google Bird Vocalization(GBV) Perch Google Bird Vocalization(GBV) しかし、コンテストには、GBV分類機の訓練セット以外の鳥種が含まれています. その結果、GBV分類機は、BirdCLEF+ 2025競技試験データセットで ~60%の精度しか達成できません. その結果、カスタムモデルを開発する必要があります. このガイドでは、独自の鳥の声化分類機構を構築する方法を詳細に説明し、GBV分類機構と併用して、より幅広い種類の鳥を分類することができます。 上記のデザインは、BirdCLEF+ 2025コンテストデータセットを活用してトレーニングを行っています。 記事 トレーニングデータ THE サポートファイルを含め、約12GBです。データセット構造を構成する主要なディレクトリとファイルは次のとおりです。 BirdCLEF+ 2025 トレーニングデータセット birdclef_2025 |__ train_audio |__ train_soundscapes |__ test_soundscapes recording_location.txt taxonomy.csv train.csv train_audio THE ディレクトリは、データセットの最大のコンポーネントで、28,564のトレーニングオーディオレコーディングレコーディングを含む。 オーディオレコーディングは、それぞれ特定の鳥種を表すサブディレクトリにグループ化されています。 train_audio .ogg train_audio |__amakin1 |__ [AUDIO FILES] |__amekes |__ [AUDIO FILES] ... THE ファイルは、サブディレクトリ名によって表される鳥種の実際の科学的および一般的な名前を検索するために使用できます。 taxonomy.csv SUB-DIRECTORY NAME SCIENTIFIC NAME COMMON NAME amakin1 Chloroceryle amazona Amazon Kingfisher amekes Falco sparverius American Kestrel ... コンテストのデータセットには、ユニークな鳥種206種類、すなわち206クラスが含まれています。 63のクラスは、 covered by the これら クラスは通常、数値クラス識別子を使用してラベル化されます。 Introduction ノー GBV Classifier Non-GBV 1139490, 1192948, 1194042, 126247, 1346504, 134933, 135045, 1462711, 1462737, 1564122, 21038, 21116, 21211, 22333, 22973, 22976, 24272, 24292, 24322, 41663, 41778, 41970, 42007, 42087, 42113, 46010, 47067, 476537, 476538, 48124, 50186, 517119, 523060, 528041, 52884, 548639, 555086, 555142, 566513, 64862, 65336, 65344, 65349, 65373, 65419, 65448, 65547, 65962, 66016, 66531, 66578, 66893, 67082, 67252, 714022, 715170, 787625, 81930, 868458, 963335, grasal4, verfly, y00678 いくつかのThe クラスは特徴: Non-GBV Limited training data. Class , for example, only contains 2 audio recordings. By contrast, class , which is a “known” class, contains 89 recordings. 1139490 amakin1 GBV Poor recording quality. Highlighting class again, both training recordings are of poor quality with one being particularly difficult to discern. 1139490 これらの2つの条件は、利用可能なオーディオおよびオーディオ品質の量に関してクラス間で大きな不均衡をもたらします。 オーディオレコーディングのレコーディングは両方 そして クラスには人間の言葉も含まれ、スピーカーは録音を記録された鳥の種や録音の場所などの詳細で注釈します。 例では、注釈は記録された鳥の音声に従います。 GBV Non-GBV しかし、すべてではない 階級の不均衡と人間の言語の注釈の存在に対処するための戦術は、 セクション Building the Classifier train_soundscapes THE ディレクトリは約1万 オーディオ録音の鳥の歌. As will be discussed in the セクションでは、これらのオーディオレコーディングは、トレーニングデータに組み込むことができます。 . train_soundscapes unlabeled Building the Classifier pseudo-labeling test_soundscapes The Directory is empty except for a このディレクトリは、BirdCLEF+ 2025 コンテストに予測結果を提出する際に隠されたテストオーディオのセットで満たされています。 test_soundscapes readme.txt CLASSIFIERの構築 基本的なアプローチと背景 使用する基本的なアプローチ 鳥の声の分類を訓練するには、以下の通りです。 Google 調査 録音したオーディオを5秒のセグメントに分ける。 オーディオセグメントをMELスペクトログラムに変換します。 メルスペクトログラムの画像分類器を訓練する。 同じアプローチがこのガイドに従うでしょう. トレーニングされる画像分類器はGoogleの モデル:もしあなたが知り合いだったら モデルのファミリー、あなたは彼らが効率的な画像処理のために設計されたことを知っています。 効率化B0 EfficientNet 効率化B0 しかし、オーディオサンプルが分割され、メルスペクトログラムに変換される前に、我々はクラス不均衡と人間の注釈の問題に取り組む必要があります。 幅広く、これらの問題は、データ拡張とオーディオサンプルの切断を通じてそれぞれ解決されます。 Training Data 実際のデザインに潜入する前に、次のサブセクションは、いくつかの短い背景情報を提供します。 効率モデル Google Researchが家族を紹介 2019年のモデルは、SET OF 当時、サイズとパフォーマンスの両方に関して、最先端のモデルを超えたモデル。 EfficientNet convolutional neural network 2021年にリリースされたモデルは、パフォーマンスとパラメータ効率をさらに向上させます。 効率2 訓練されているにもかかわらず、 データ、EfficientNetモデルは、他のデータセットに移行する際に有用性を示し、このプロジェクトの分類技術として魅力的な選択肢となっています。 イラスト メル・スペクトログラム A mel spectrogram is a visual representation of an audio signal. It might best be analogized to a heatmap for sound. メルスペクトログラムは、オーディオ信号の視覚的表現であり、音のための熱地図に最もよく類似される可能性があります。 メルスペクトログラムのx軸はオーディオ信号の時間次元を表し、y軸は信号内の音の周波数を表します。 これらのバンドは、反対に、使用するスペースを外します。 メル・スケールはA 人間の聴覚システムと、人間がどのように音を感知するかを比較するスケールです. ミルスペクトログラムの色は、帯域内の音の幅を表します. 明るい色は、より高い幅を表し、暗い色は、より低い幅を表します. mel bands mel scale logarithmic デザイン デザインを論じる私の目標は、あまりにも細部に突入せずにアプローチの高レベルのレビューを提供することです。 「トレーニングノート」は、以下の4つの主要セクションで構成されています。 カグレノブ セクション1:オーディオデータのロード 第2章 オーディオデータの処理 セクション3:Melのスペクトログラム生成と入力準備。 第4章 モデルトレーニング 各メインセクションの最初の 2 つのセルは (1)そのセクションで使用される輸入および (2) a このセクションおよびその後のセクションで使用される常数を定義するセル。 Config トレーニングノートは実際に始まります。 ノートブック全体で使用される基本的な Python パッケージがインポートされる場所 このセクションには、ログインするための論理も含まれています。 ("WandB") for tracking training runs. あなたは自分のWandBを付加する必要があります ノートとしてA using the name . Section 0 Weights & Biases API key Kaggle Secret WANDB_API_KEY で議論されたように、 セクションでは、ラベルなしのトレーニングサウンドキャップは、偽のラベル化を介してトレーニングデータに組み込まれることができます。 Kaggle 非 GPU 環境は 30 GiB のメモリに制限されていることに留意してください。 Training Data Section 3.5 - Pseudo-Labeling 次のサブセクションで説明された実験的な設定に従って訓練されたモデルがここにKaggleに投稿されました. 望むなら、あなたは自分の訓練なしでこのモデルを使用し、鳥の歌のオーディオで推論を実行するためにRunning Inferenceセクションに直接ジャンプすることができます。 次のサブセクションで説明された実験的な設定に従って訓練されたモデルがここにKaggleに投稿されました. 望むなら、あなたは自分の訓練なしでこのモデルを使用し、鳥の歌のオーディオで推論を実行するためにRunning Inferenceセクションに直接ジャンプすることができます。 セクション1 - オーディオデータのロード THE ノートの部分: Audio Data Loading GBV分類に含まれていないBirdCLEF+ 2025コンテストデータセットのクラスを抽出します。 load_training_audio メソッドでオーディオデータをロードします。 processed_audio ディレクトリを作成し、ロードされたオーディオデータのコピーをそのディレクトリに .wav ファイルとして保存します。 THE このセクションのセクションはA constant. This constant specifies the maximum number of audio files to be loaded from a given class. この Constant は任意に大きな値に設定されます。 すべてのオーディオファイルがインストールされていることを確認するために クラス. この常数を自分の実験設定で調整する必要がある場合があります. たとえば、オーディオデータを クラスでは、この常数を低い値に設定する必要がある場合がありますので、利用可能なメモリを枯渇させないようにします。 Config MAX_FILES 1000 non-GBV all THE 方法はAと呼ぶことができます。 このパラメータは、オーディオがロードされるクラスのリストです。 クラスはリストとして保存され、変数に割り当てられます。 その後、引き継がれるのは、 方法を通してThe パラメータ load_training_audio classes non-GBV missing_classes load_training_audio classes # `missing_classes` list ['1139490', '1192948', '1194042', '126247', '1346504', '134933', '135045', '1462711', '1462737', '1564122', '21038', '21116', '21211', '22333', '22973', '22976', '24272', '24292', '24322', '41663', '41778', '41970', '42007', '42087', '42113', '46010', '47067', '476537', '476538', '48124', '50186', '517119', '523060', '528041', '52884', '548639', '555086', '555142', '566513', '64862', '65336', '65344', '65349', '65373', '65419', '65448', '65547', '65962', '66016', '66531', '66578', '66893', '67082', '67252', '714022', '715170', '787625', '81930', '868458', '963335', 'grasal4', 'verfly', 'y00678'] クラスパラメーターとして空のリストを渡すことで、すべての 206 BirdCLEF+ 2025 クラスをロードできます。 You can load all 206 BirdCLEF+ 2025 classes by passing an empty list as the パラメータ classes load_training_audio method also accepts an optional boolean use_slice parameter. This parameter works with the LOAD_SLICE constant defined in the Config cell. The use_slice parameter and LOAD_SLICE constant are not used with this implementation. However, they can be used to load a specific amount of audio from each file. For example, to load only 5 seconds of audio from each audio file, set LOAD_SLICE to 160000, which is calculated as 5 times the sampling rate of 32000; and pass True to the use_slice parameter. このパラメータは、Config セルで定義された LOAD_SLICE 常数で動作します。 THE method also accepts an optional boolean パラメータ: このパラメータは、 常に定義されている「the セル・ザ・ パラメータおよび 絶え間なく ただし、各ファイルから特定のオーディオの量をロードするために使用することができます. たとえば、各オーディオファイルからオーディオの5秒だけをロードするには、 2位 , which is calculated as times the sampling rate of サンプルレート ; and pass 2 THE パラメータ load_training_audio use_slice LOAD_SLICE Config use_slice LOAD_SLICE not LOAD_SLICE 160000 5 32000 True use_slice THE Method Accepts a Boolean(ボーレアン) このパラメーターが 論理は創造する a ディレクトリを保存し、各オーディオサンプルのコピーをA file to the directory. オーディオコピーは、それらが属するクラスを反映するサブディレクトリに保存されます。 ディレクトリは次のセクションで、変更されたオーディオサンプルを BirdCLEF+ 2025 データセットディレクトリに影響を与えずにディスクに保存するために使用されます。 load_training_audio make_copy True processed_audio .wav processed_audio THE キーとしてクラス名を使用したロードされたオーディオデータの辞書を返します. each value in the dictionary is a list of tuples of the form : load_training_audio (AUDIO_FILENAME, AUDIO_DATA) {'1139490': [('CSA36389.ogg', tensor([[-7.3379e-06, 1.0008e-05, -8.9483e-06, ..., 2.9978e-06, 3.4201e-06, 3.8700e-06]])), ('CSA36385.ogg', tensor([[-2.9545e-06, 2.9259e-05, 2.8138e-05, ..., -5.8680e-09, -2.3467e-09, -2.6546e-10]]))], '1192948': [('CSA36388.ogg', tensor([[ 3.7417e-06, -5.4138e-06, -3.3517e-07, ..., -2.4159e-05, -1.6547e-05, -1.8537e-05]])), ('CSA36366.ogg', tensor([[ 2.6916e-06, -1.5655e-06, -2.1533e-05, ..., -2.0132e-05, -1.9063e-05, -2.4438e-05]])), ('CSA36373.ogg', tensor([[ 3.4144e-05, -8.0636e-06, 1.4903e-06, ..., -3.8835e-05, -4.1840e-05, -4.0731e-05]])), ('CSA36358.ogg', tensor([[-1.6201e-06, 2.8240e-05, 2.9543e-05, ..., -2.9203e-04, -3.1059e-04, -2.8100e-04]]))], '1194042': [('CSA18794.ogg', tensor([[ 3.0655e-05, 4.8817e-05, 6.2794e-05, ..., -5.1450e-05, -4.8535e-05, -4.2476e-05]])), ('CSA18802.ogg', tensor([[ 6.6640e-05, 8.8530e-05, 6.4143e-05, ..., 5.3802e-07, -1.7509e-05, -4.8914e-06]])), ('CSA18783.ogg', tensor([[-8.6866e-06, -6.3421e-06, -3.1125e-05, ..., -1.7946e-04, -1.6407e-04, -1.5334e-04]]))] ...} The method also returns basic statistics describing the data loaded for each class as a comma-separated-value string. You can optionally export these statistics to inspect the data. class,sampling_rate,num_files,num_secs_loaded,num_files_loaded 1139490,32000,2,194,2 1192948,32000,4,420,4 1194042,32000,3,91,3 ... Section 2 - Audio Data Processing THE ノートの部分: Audio Data Processing Optionally strips silent segments and slices audio to eliminate most human annotations from raw audio. Stripping silent segments eliminates irrelevant parts of the audio signal. Optionally augments audio for minority classes to help address the class imbalance. Audio augmentation consists of (1) adding a randomly generated noise signal, (2) changing the tempo of the raw audio, or (3) adding a randomly generated noise signal and changing the tempo of the raw audio. セクション 2.1 - 静かなセグメントの検出 The method is used to "slide" over each raw audio sample and identify silent segments by comparing the value of a given segment to a specified threshold. If the RMS is below the threshold, the segment is identified as a silent segment. The following constants specified in the このセクションのセルは、このセクションの行動を制御します。 method: detect_silence root-mean square (RMS) Config detect_silence SIL_FRAME_PCT_OF_SR = 0.25 SIL_FRAME = int(SR * SIL_FRAME_PCT_OF_SR) SIL_HOP = int(1.0 * SIL_FRAME) SIL_THRESHOLD = 5e-5 SIL_REPLACE_VAL = -1000 # Value used to replace audio signal values within silent segments THE そして constants can be modified to adjust how the method "slides" over the raw audio. Similarly, the value can be modified to make the method more aggressive or conservative with respect to identification of silent segments. SIL_FRAME SIL_HOP SIL_THRESHOLD The method outputs a dictionary of silent segment markers for each file in each class. Audio files with no detected silent segments are identified by empty lists. {'1139490': {'CSA36389.ogg': [0, 8000, 16000, 272000, 280000, 288000, 296000, 304000], 'CSA36385.ogg': [0, 8000, 16000, 24000, 240000, 248000, 256000]}, '1192948': {'CSA36388.ogg': [0, 8000, 16000, 24000, 256000, 264000, 272000, 288000], 'CSA36366.ogg': [0, 8000, 16000, 24000, 256000, 264000, 272000, 280000, 288000], 'CSA36373.ogg': [0, 8000, 16000, 24000, 256000, 264000, 272000, 288000], 'CSA36358.ogg': [8000]}, '1194042': {'CSA18794.ogg': [], 'CSA18802.ogg': [], 'CSA18783.ogg': [0, 8000, 16000, 24000, 600000, 608000, 616000]}, '126247': {'XC941297.ogg': [], 'iNat1109254.ogg': [], 'iNat888527.ogg': [], 'iNat320679.ogg': [0], 'iNat888729.ogg': [], 'iNat146584.ogg': []}, '1346504': {'CSA18803.ogg': [0, 8000, 16000, 24000, 3000000, 3008000, 3016000], 'CSA18791.ogg': [], 'CSA18792.ogg': [], 'CSA18784.ogg': [0, 8000, 16000, 1232000, 1240000, 1248000], 'CSA18793.ogg': [0, 8000, 16000, 24000, 888000]} ...} Section 2.2 - Removing Silent Segments and Eliminating Human Annotations The 常に定義されている「the cell of this section specifies if audio should be stripped of silent segments sliced to remove 人間の注釈 USE_REMOVE_SILENCE_AND_HUMAN_ANNOT Config そして トップ USE_REMOVE_SILENCE_AND_HUMAN_ANNOT = True THE method strips silent segments from audio samples using the output from the さらに、単純な観察に基づいて人間の注釈を処理するための論理を実装する:多くのオーディオサンプル、すなわち人間の注釈を持つサンプル、 to have the following structure: remove_silence_and_human_annot detect_silence テント | < 10s | ~1s | | | BIRDSONG | SILENCE | HUMAN ANNOTATION | The birdsong and human annotation sections themselves may contain silent segments. However, as seen in the diagram above, the bird vocalization recordings often occur within the first few seconds of audio. Therefore, a simple, if imperfect, approach to deal with human annotations is to slice audio samples at the first silent segment marker that occurs outside of a specified window, under the assumption that a human annotation follows that silent segment. The logic uses the constant in the cell to check if a silent segment marker lies outside the window specified by , expressed in number of seconds. If it does, the logic slices the raw audio at that marker and only retains the data that occurs before it. A manual inspection of processed audio during experimentation revealed this approach to be satisfactory. However, as mentioned in the セクション: There Are オーディオ録音は、人間の注釈が オリジナルタイトル: The Logic Described Here いくつかのオーディオサンプルには、記録された鳥の歌の長いシーケンスがあり、これらのサンプルはしばしば静かなセグメントを持っていない。 remove_silence_and_human_annot ANNOT_BREAKPOINT Config ANNOT_BREAKPOINT Training Data some precedes ノー A second constant, , can be optionally used in a final processing step to return an even more refined slice of the processed audio. Set to the number of seconds of processed audio that you want to retain. SLICE_FRAME SLICE_FRAME THE メソッドは、処理されたオーディオをディスクにディレクトリの下に保存します。 via the パラメーター: Passed as The method returns a dictionary of the seconds of processed audio for each class. remove_silence_and_human_annot processed_audio save_audio True total {'1139490': 14, '1192948': 29, '1194042': 24, '126247': 48, '1346504': 40, '134933': 32, '135045': 77, ...} The method is used following すべてのクラスでオーディオの平均秒数を得るために。 get_audio_stats remove_silence_and_human_annot Section 2.3 - Calculating Augmentation Turns for Minority Classes で述べたように、The section, the classes are not balanced. Augmentation is used in this notebook section to help address the imbalance leveraging the average number of seconds of audio across all classes, as provided by the method. Classes with total seconds of processed audio. 処理されたオーディオの合計秒数を含むクラス 平均値は増えていますが、 method determines the number of augmentation turns for each minority class using the average number of seconds per processed audio sample. Training Data get_audio_stats below get_augmentation_turns_per_class TURNS = (AVG_SECS_AUDIO_ACROSS_CLASSES - TOTAL_SECS_AUDIO_FOR_CLASS)/AVG_SECS_PER_AUDIO_SAMPLE 平均を下回る少数階級は、平均に近い少数階級に比べ、増加回数が少なくなる。 get_augmentation_turns_per_class には、AVG_SECS_FACTOR 常数が含まれています。 average number of seconds of audio across all classes. The constant can be used to make the logic more conservative or aggressive when calculating the number of augmentation turns. The includes a 値を調整するために使用できる常数 get_augmentation_turns_per_class AVG_SECS_FACTOR average number of seconds of audio across all classes. The constant can be used to make the logic more conservative or aggressive when calculating the number of augmentation turns. セクション 2.4 - Running Augmentations The 常に定義されている「the このセクションのセルは、オーディオを拡大するかどうかを指定します。 USE_AUGMENTATIONS Config USE_AUGMENTATIONS = True 前述したように、オーディオ増加は、(1)ランダムに生成されたノイズ信号を追加すること、(2)原音のテンポを変更すること、または(3)ランダムに生成されたノイズ信号を追加し、原音のテンポを変更することから構成されます。 and methods encapsulate the logic for adding a noise signal and changing the tempo respectively. The noise signal range and tempo change range can be adjusted via the following constants in the cell: add_noise change_tempo Config NOISE_RNG_LOW = 0.0001 NOISE_RNG_HIGH = 0.0009 TEMPO_RNG_LOW = 0.5 TEMPO_RNG_HIGH = 1.5 The method runs the augmentations using the output from the method. For those classes that will be augmented, the logic: 拡大されるクラスのための論理: run_augmentations get_augmentations_turns_per_class Randomly selects a processed audio sample (i.e. silent segments already removed) for augmentation. (1)ノイズを追加し、(2)ペースを変更し、または (3)ノイズを追加し、ペースを変更する。 Saves the augmented audio to disk under the appropriate class within the directory. processed_audio While the notebook logic augments minority classes with total seconds of audio below the average, it ignores those classes with total seconds of audio above the average. This approach was taken to manage available memory and with the understanding that the class imbalance is further addressed through choice of the loss function. Section 3 - Mel Spectrogram Generation and Input Preparation THE ノートの部分: Mel Spectrogram Generation and Input Preparation 処理されたオーディオデータをトレーニングと検証リストに分割します。 オーディオを5秒のフレームに分ける。 毎秒5秒のオーディオフレームに対してメルスペクトログラムを生成します。 Resizes mel spectrograms to a target size of . (224, 224) 選択肢として、プセドラベル化されたデータサンプルをロードしてトレーニングデータを拡大します。 One-hot encodes training data and validation data labels. Constructs TensorFlow objects from training and validation data lists. Dataset Optionally uses MixUp logic to augment training data. セクション 3.1 - 処理されたオーディオデータの分割 Processed audio data is loaded from the folder. The data is split into 4 lists: processed_audio training_audio training_labels validation_audio validation_labels ラベルは、もちろん、オーディオ例と関連するクラス名です。 constant defined in the cell controls the split ratio between the training and validation data lists. Processed audio data is shuffled before splitting. SPLIT Config Section 3.2 - オーディオをフレームに分割する Audio is split into 5 second segments using the TensorFlow を使用する方法 それぞれの音声例を分割する方法. The following constants in the 細胞は、分割操作を制御します。 frame_audio signal.frame Config FRAME_LENGTH = 5 FRAME_STEP = 5 セクション3.3 - Mel Spectrogramsの生成 Mel spectrograms are generated for each 5 second audio frame generated in 経由 The 方法. The following constants in the cell specify the parameters used when generating the mel spectrograms, such as the number of mel bands, minimum frequency, and maximum frequency: Section 3.2 audio2melspec Config # Mel spectrogram parameters N_FFT = 1024 # FFT size HOP_SIZE = 256 N_MELS = 256 FMIN = 50 # minimum frequency FMAX = 14000 # maximum frequency The frequency band was chosen to reflect the range of most bird vocalizations. However, some bird species can vocalize outside this range. potential セクション 3.4 - メル・スペクトログラムの再構築 THE method is used to convert each mel spectrogram to a 対象:各 object is subsequently resized to EfficientNet B0 モデルで期待される入力サイズです。 to_melspectrogram_image pillow Image Image (224, 224) Section 3.5 - Loading Pseudo-Labeled Data で述べたように、The セクション、The ディレクトリは約1万 鳥の歌の音声レコーディング これらの音声レコーディングは、トレーニングデータに組み込むことができます。 . A simple process to create pseudo-labeled data is as follows: Training Data train_soundscapes unlabeled pseudo-labeling Train a classifier pseudo-labeled data. without Load training soundscape audio files. Segment each audio soundscape into 5 second frames. 毎回5秒のフレームでミルスペクトログラムを生成し、サイズを変更する(224、224)。 あなたが最初のステップで訓練した分類器を使用して、それぞれのリメイクされたミルスペクトログラムで予測を実行します。 予測を望ましい信頼レベル以上に保ち、予測されたクラスラベルの下でディスクにそれらの予測のためのメルスペクトログラムを保存します。 Psuedo-labeled データを使用して再度分類をトレーニングします。 Pseudo-labeled data can improve the performance of your classifier. If you want to generate your own pseudo-labeled data, you should continue with the remaining sections to train a classifier. Pseudo-labeled data can improve the performance of your classifier. あなたが自分の Pseudo-labeled dataを生成したい場合は、残りのセクションでトレーニングする必要があります。 pseudo-labeled data. Then, use your classifier to create your own set of pseudo-labeled data using the process outlined above. 最後に、あなたの pseudo-labeled data を使用してあなたの classifier を再トレーニングします。 なし この実装では、偽のラベル化されたデータは使用されていません。しかし、参考にした推測ノートを変更できます。 section to generate pseudo-labeled data. Running Inference Set the constant in the cell to to skip the use of pseudo-labeled data. USE_PSEUDO_LABELS Config False セクション 3.6 - コードラベル The One-hot coded labels are returned as NumPy array and added to the training label and validation label lists. One-hot coded labels are returned as NumPy array and added to the training label and validation label lists. One-hot coded labels are returned as NumPy array and added to the training label and validation label lists. process_labels セクション 3.7 - トレーニングおよび検証データリストをTensorFlowに変換する 物体 Dataset Dataset TensorFlowについて TensorFlow を作成する方法 トレーニングおよび検証データリストからのオブジェクト。The トレーニングに呼ばれる方法 shuffle training data before batching. トレーニングデータをバッチする前に shuffle method is called on both objects to batch the training and validation datasets. The constant in the cell は batch サイズを制御します。 data.Dataset.from_tensor_slices Dataset shuffle Dataset batch Dataset BATCH_SIZE Config セクション 3.8 - MixUp を使用してトレーニングデータを増やす あなたがすでに知っているように、MixUpは、2つの画像を効果的に混合して新しいデータサンプルを作成するデータ拡張技術です。 method, along with the method, encapsulates the optional MixUp logic. mix_up sample_beta_distribution この実装では、MixUp を使用してトレーニングデータを拡張します。 constant in the セル2 . USE_MIXUP Config True Section 4 - Model Training The ノートの部分: Model Training WandB プロジェクトを初期化および構成し、トレーニング実行データをキャプチャします。 EfficientNet B0 モデルを構築し、コンパイルします。 Trains the model. Saves the trained model to disk. セクション 4.1 - Initializing and Configuring WandB Project ノートブックに独自の WandB API キーを Kaggle Secret として付属し、ノートブックのセクション 0 の WandB ログイン方法が True を返したことを確認します。 自分のWandB API キーを A として付属していることを確認します。 to the notebook and that the WandB method in ノートが戻ってきました♪ . Kaggle Secret login Section 0 True The このセクションのセルには、トレーニング実行データをキャプチャする新しい WandB プロジェクト(プロジェクトが既に存在しない場合)を初期化および構成するための論理が含まれています。 Config wandb.init(project="my-bird-vocalization-classifier") config = wandb.config config.batch_size = BATCH_SIZE config.epochs = 30 config.image_size = IMG_SIZE config.num_classes = len(LABELS) Obviously, you can change the project name to your desired WandB project name. my-bird-vocalization-classifier セクション 4.2 - EfficientNet B0 モデルの構築と構築 THE method is used to load the pre-trained EfficientNet B0 model with ImageNet weights and without the top layer: build_model model = EfficientNetB0(include_top=False, input_tensor=inputs, weights="imagenet") The model is frozen to leverage the pre-trained ImageNet weights with the objective to only (i.e. train) layers in the final stage of the model: (i.e. train) layers in the final stage of the model: unfreeze # Unfreeze last `unfreeze_layers` layers and add regularization for layer in model.layers[-unfreeze_layers:]: if not isinstance(layer, layers.BatchNormalization): layer.trainable = True layer.kernel_regularizer = tf.keras.regularizers.l2(L2_RATE) コンスタント IN THE cell specifies the number of layers to unfreeze. UNFREEZE_LAYERS Config モデルのトップは、最終的なものと再構築されています。 鳥類の種類を表すカテゴリ。 損失機能として選択され、クラスの不均衡に対処するのに役立ちます。 そして constants in the セルは、損失関数を使用します。 Dense Categorical focal cross-entropy LOSS_ALPHA LOSS_GAMMA Config セクション 4.3 - モデルトレーニング THE Method is called on the compiled から トレーニングを進めば、A コールバック、 , is used instead of a constant learning rate. 初期の学習率は、 is hardcoded into the callback. The learning rate is decreased in 2 stages based on the epoch count. The number of training epochs is controlled by the constant in the cell. fit model Section 4.2 learning rate scheduler lr_scheduler 4.0e-4 EPOCHS Config Section 4.4 - Model Saving The Method is called on the compiled トレーニング後、モデルをディスクに保存します。 save model model.save("bird-vocalization-classifier.keras") トレーニング結果 ノートブックを実行するには、以下のトレーニング結果を生成する必要がありますが、このノートブックで説明された実験設定を使用したと仮定します。 セクション: Building the Classifier 見たように、精度はわずか90%を超え、検証精度は30の時代のトレーニング後に約70%です。しかし、見たように、検証精度は大幅に変動します。この変異は部分的にクラスの不均衡に起因し、利用可能なメモリは、不均衡を完全に解決するために追加の増加の使用を制限します。結果は、モデルがトレーニングデータの過剰装備に苦しんでおり、期待されるように一般化しません。 INFERENCE 走る This ("inference notebook") は推論を実行するために使用できます。 推論ノートロジックは、GBV 分類モデルと、前のセクションでトレーニングしたモデルを両方使用します。 ディレクトリ. 各 soundcapes オーディオ ファイルは 5 秒のフレームに分かれています。 常に定義されている「the 細胞 of the notebook は、推論のためにロードされている soundcapes オーディオファイルの数を制御します。 カグレノブ train_soundscapes MAX_FILES Config Section 0 推測ノートはまずGBV分類器を使用して予測を生成します。GBV分類器に知られている143のBirdCLEF+ 2025競争データセットクラスの予測は分離されます。 , GBV 予測クラスが真のクラスとして選択される場合、143 つの「知られている」クラスの中の最大確率が以下である場合 , it is assumed that the true class is among the 63 classes "unknown" to the GBV classifier - i.e. the classes used to train the model in the preceding section. The logic then runs predictions using the finetuned model. The predicted class from that prediction set is subsequently selected as the true class. つまり、以前のセクションでモデルを訓練するために使用されたクラスであると仮定されます。 GBV_CLASSIFIER_THRESHOLD GBV_CLASSIFIER_THRESHOLD THE constant が定義されています。 細胞 予測は2ファイルの出力です: GBV_CLASSIFIER_THRESHOLD Config Section 5 preds.csv ファイルは、あらゆる 5 秒間のサウンド スクエップの予測と予測の確率をキャプチャします。 submission.csv ファイルは、BirdCLEF+ 2025 コンテストの形式でクラスのすべての確率をキャプチャします。 推測ノートのセクション 4 の最初のセクションの細かいモデルへのパスを設定します。 推測ノートのセクション 4 の最初のセクションの細かいモデルへのパスを設定します。 将来の仕事 トレーニングノートは、すべての206 BirdCLEF+ 2025クラスのモデルをトレーニングするために使用することができ、少なくとも競争データセットに関して、GBV分類器の必要性を排除します。 , to the メソッドは、すべてのクラスのオーディオデータをロードします。 そして 常数は、充電されたオーディオの量を制限して、Kaggle ノートブック環境の限界内で動作するために使用できます。 [] load_training_audio MAX_FILES LOAD_SLICE Of course, a more accurate model can be trained using a larger amount of training data. Ideally, a greater number of augmentations would be used to address the class imbalance. Additionally, other augmentation techniques, such as CutMix, could be implemented to further augment the training data. However, these strategies demand a more robust development environment.