Add FSD50K Part 1 training documentation
Browse files
model_checkpoints/Primitive_Extractor/FSD50k/training_script_part1.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FSD50K Primitive Extractor Training - Part 1
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
This document describes the training of a **Primitive Extractor** on the FSD50K dataset (Part 1 only), using transfer learning from a pretrained Clotho checkpoint.
|
| 5 |
+
|
| 6 |
+
## Architecture
|
| 7 |
+
The model is a **36.7M parameter** Primitive Extractor with three main components:
|
| 8 |
+
|
| 9 |
+
### 1. Extractor (Encoder) - From Clotho
|
| 10 |
+
- **Conv Stack**: 3 Γ (Conv1d β Transpose β LayerNorm β Transpose β GELU)
|
| 11 |
+
- Conv1d(768 β 1728, k=7)
|
| 12 |
+
- Conv1d(1728 β 1728, k=5)
|
| 13 |
+
- Conv1d(1728 β 1728, k=3)
|
| 14 |
+
- **Projection**: Linear(1728 β 512) + LayerNorm
|
| 15 |
+
- **Self-Attention**: MultiheadAttention(512, 8 heads) + residual + LayerNorm
|
| 16 |
+
- **Output**: 512-dimensional primitive vectors (seq_len, 512)
|
| 17 |
+
|
| 18 |
+
### 2. Decoder - From Clotho
|
| 19 |
+
- Linear(512 β 1024) + GELU
|
| 20 |
+
- Linear(1024 β 768)
|
| 21 |
+
- **Purpose**: Reconstruct the original 768-dim BEATs features for the reconstruction_loss
|
| 22 |
+
|
| 23 |
+
### 3. Classifier Head - NEW for FSD50K
|
| 24 |
+
- Linear(512 β 512) + GELU + Dropout(0.2)
|
| 25 |
+
- Linear(512 β 200)
|
| 26 |
+
- **Purpose**: Predict the 200 FSD50K sound classes
|
| 27 |
+
|
| 28 |
+
## Training Configuration
|
| 29 |
+
- **Dataset**: FSD50K Part 1 (7,343 matched samples)
|
| 30 |
+
- Train: 6,608 samples
|
| 31 |
+
- Validation: 735 samples
|
| 32 |
+
- **Features**: 768-dim BEATs features (variable length per clip)
|
| 33 |
+
- **Pretrained weights**: `primitive_extractor_clotho_recon_best.pt` (26 parameter tensors transferred)
|
| 34 |
+
- **Epochs**: 8
|
| 35 |
+
- **Optimizer**: AdamW (lr=2e-4, weight_decay=1e-4)
|
| 36 |
+
- **Scheduler**: Cosine decay with 10% warmup (5,286 steps)
|
| 37 |
+
- **Loss function**:
|
| 38 |
+
- Classification: Weighted BCE (pos_weight handles class imbalance)
|
| 39 |
+
- reconstruction_loss: MSE (between input BEATs and decoder output)
|
| 40 |
+
- Total: `weighted_bce_loss + 0.1 * reconstruction_loss`
|
| 41 |
+
- **Checkpoint metric**: Validation mAP (macro) β saved only when improved
|
| 42 |
+
|
| 43 |
+
## Loss Strategy
|
| 44 |
+
- **Weighted BCE** (optimization loss): Handles FSD50K's multi-label nature and class imbalance. Rare classes get higher penalty.
|
| 45 |
+
- **reconstruction_loss** (regularization): Forces the 512-dim bottleneck to preserve acoustic details, not just collapse into a classifier.
|
| 46 |
+
- **mAP** (checkpoint metric): Non-differentiable ranking metric that measures real classification quality.
|
| 47 |
+
|
| 48 |
+
## Results
|
| 49 |
+
|
| 50 |
+
| Epoch | weighted_bce_loss | reconstruction_loss | total_loss | val_mAP |
|
| 51 |
+
|-------|-------------------|---------------------|------------|---------|
|
| 52 |
+
| 1 | 0.4938 | 0.1174 | 0.5055 | 24.24% |
|
| 53 |
+
| 2 | 0.3081 | 0.1301 | 0.3211 | 30.68% |
|
| 54 |
+
| 3 | 0.2400 | 0.1259 | 0.2526 | 37.76% |
|
| 55 |
+
| 4 | 0.1911 | 0.1227 | 0.2034 | 41.97% |
|
| 56 |
+
| 5 | 0.1486 | 0.1197 | 0.1605 | 47.50% |
|
| 57 |
+
| 6 | 0.1161 | 0.1173 | 0.1278 | 50.70% |
|
| 58 |
+
| 7 | 0.0964 | 0.1154 | 0.1079 | 52.41% |
|
| 59 |
+
| 8 | 0.0860 | 0.1145 | 0.0974 | **52.72%** |
|
| 60 |
+
|
| 61 |
+
### Best Result
|
| 62 |
+
- **Validation mAP**: **52.72%** (achieved at epoch 8)
|
| 63 |
+
- **Checkpoint**: `best_fsd50k_primitive.pt`
|
| 64 |
+
|
| 65 |
+
## Notes
|
| 66 |
+
- The sklearn warnings about "No positive class found in y_true" are expected. With only 735 validation samples across 200 classes, many rare classes have zero examples in the validation split. This does not affect the macro mAP calculation.
|
| 67 |
+
- reconstruction_loss stayed stable (~0.11-0.13) throughout training, confirming the bottleneck preserves acoustic information while learning to classify.
|
| 68 |
+
|
| 69 |
+
## Limitations
|
| 70 |
+
- Only trained on **Part 1** (7,343 samples). Full FSD50K has **36,796 training samples** across parts 1-5.
|
| 71 |
+
- The 52.72% mAP is a strong baseline but expected to improve significantly with the full dataset.
|
| 72 |
+
|
| 73 |
+
## Next Steps
|
| 74 |
+
1. Extract BEATs features for parts 2-5
|
| 75 |
+
2. Retrain on the full 36,796 samples
|
| 76 |
+
3. Evaluate on the separate FSD50K eval set (10,234 files)
|
| 77 |
+
4. Consider longer training (15-20 epochs) with full data
|
| 78 |
+
|
| 79 |
+
## Files
|
| 80 |
+
- `best_fsd50k_primitive.pt` β Best checkpoint (52.72% mAP)
|
| 81 |
+
- `training_result_part1.json` β Machine-readable results
|
| 82 |
+
- `training_script_part1.md` β This file
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
*Trained on October 06, 2026*
|