{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/sound-event-detection-of-weakly-labelled-data","title":"Sound Event Detection of Weakly Labelled Data with CNN-Transformer and Automatic Threshold Optimization","arxiv_id":"1912.04761","date":"2019-12-10","proceeding":null,"authors":["Qiuqiang Kong","Yong Xu","Wenwu Wang","Mark D. Plumbley"],"abstract":"Sound event detection (SED) is a task to detect sound events in an audio recording. One challenge of the SED task is that many datasets such as the Detection and Classification of Acoustic Scenes and Events (DCASE) datasets are weakly labelled. That is, there are only audio tags for each audio clip without the onset and offset times of sound events. \\qk{We compare segment-wise and clip-wise training for SED that is lacking in previous works. We propose a convolutional neural network transformer (CNN-Transfomer) for audio tagging and SED, and show that CNN-Transformer performs similarly to a convolutional recurrent neural network (CRNN)}. Another challenge of SED is that thresholds are required for detecting sound events. Previous works set thresholds empirically, and are not an optimal approaches. To solve this problem, we propose an automatic threshold optimization method. The first stage is to optimize the system with respect to metrics that do not depend on thresholds, such as mean average precision (mAP). The second stage is to optimize the thresholds with respect to metrics that depends on those thresholds. Our proposed automatic threshold optimization system achieves a state-of-the-art audio tagging F1 of 0.646, outperforming that without threshold optimization of 0.629, and a sound event detection F1 of 0.584, outperforming that without threshold optimization of 0.564.","url_abs":"http://arxiv.org/abs/1912.04761v2","url_pdf":"http://arxiv.org/pdf/1912.04761v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"links_only","authors_date_abstract":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license), from the Kaggle arXiv metadata snapshot of 2026-09-12"},"code_links":[{"paper_slug":"sound-event-detection-of-weakly-labelled-data","repo_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/1912.04761","atlas_url":"https://app.syntology.ai/?focus=1912.04761","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1912.04761"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":1,"unverified":18},"by_repo_kind":{"official":{"samples":19,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":19,"samples":[{"code_sha256_prefix":"6e703419174005ee","entry":"move_data_to_device","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"pytorch/pytorch_utils.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/pytorch/pytorch_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"6e703419174005ee"}},{"code_sha256_prefix":"f4dff30cd8cfc4d1","entry":"activity_detection","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/vad.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/vad.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"f4dff30cd8cfc4d1"}},{"code_sha256_prefix":"0ee9e38bde8e7696","entry":"activity_detection_with_second_thres","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/vad.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/vad.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"0ee9e38bde8e7696"}},{"code_sha256_prefix":"1349c3b2a705a7c1","entry":"calculate_precision_recall_f1","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/calculate_metrics.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/calculate_metrics.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"1349c3b2a705a7c1"}},{"code_sha256_prefix":"1054ac2d218db84a","entry":"clip_bce","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"pytorch/losses.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/pytorch/losses.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"1054ac2d218db84a"}},{"code_sha256_prefix":"d497b4fb90f048fb","entry":"collate_fn","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/data_generator.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/data_generator.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"d497b4fb90f048fb"}},{"code_sha256_prefix":"b104f90eac5b11a0","entry":"create_logging","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/utilities.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/utilities.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"b104f90eac5b11a0"}},{"code_sha256_prefix":"d4f4008124de38f4","entry":"do_mixup","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"pytorch/pytorch_utils.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/pytorch/pytorch_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"d4f4008124de38f4"}},{"code_sha256_prefix":"5cb0c395bc13697e","entry":"find_bgn_fin_pairs","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/vad.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/vad.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"5cb0c395bc13697e"}},{"code_sha256_prefix":"3fef75ce55cfc573","entry":"forward","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"pytorch/pytorch_utils.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/pytorch/pytorch_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"3fef75ce55cfc573"}},{"code_sha256_prefix":"6f7539ff72b6da37","entry":"get_filename","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/utilities.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/utilities.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"6f7539ff72b6da37"}},{"code_sha256_prefix":"8c5cf2ee2f049223","entry":"get_loss_func","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"pytorch/losses.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/pytorch/losses.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"8c5cf2ee2f049223"}},{"code_sha256_prefix":"dc424c820e96f8a2","entry":"get_metric","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/calculate_metrics.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/calculate_metrics.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"dc424c820e96f8a2"}},{"code_sha256_prefix":"13cc96d3a655a1be","entry":"get_weak_csv_filename","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/features.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/features.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"13cc96d3a655a1be"}},{"code_sha256_prefix":"ab133d31ba67d6f0","entry":"interpolate","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"pytorch/models.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/pytorch/models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"ab133d31ba67d6f0"}},{"code_sha256_prefix":"9f635b280d3ff53a","entry":"pad_truncate_sequence","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/utilities.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/utilities.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"9f635b280d3ff53a"}},{"code_sha256_prefix":"ced62483b0719293","entry":"read_strong_csv","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/features.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/features.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"ced62483b0719293"}},{"code_sha256_prefix":"e2e38c61347ec137","entry":"read_weak_csv","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"utils/features.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/utils/features.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"e2e38c61347ec137"}},{"code_sha256_prefix":"7022972db0a9d9bd","entry":"sed_average_precision","repo":"qiuqiangkong/sound_event_detection_dcase2017_task4","repo_kind":"official","path":"pytorch/evaluate.py","file_url":"https://github.com/qiuqiangkong/sound_event_detection_dcase2017_task4/blob/HEAD/pytorch/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"7022972db0a9d9bd"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}