{"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/modality-aware-contrastive-instance-learning","title":"Modality-Aware Contrastive Instance Learning with Self-Distillation for Weakly-Supervised Audio-Visual Violence Detection","arxiv_id":"2207.05500","date":"2022-07-12","proceeding":null,"authors":["Jiashuo Yu","Jinyu Liu","Ying Cheng","Rui Feng","Yuejie Zhang"],"abstract":"Weakly-supervised audio-visual violence detection aims to distinguish snippets containing multimodal violence events with video-level labels. Many prior works perform audio-visual integration and interaction in an early or intermediate manner, yet overlooking the modality heterogeneousness over the weakly-supervised setting. In this paper, we analyze the modality asynchrony and undifferentiated instances phenomena of the multiple instance learning (MIL) procedure, and further investigate its negative impact on weakly-supervised audio-visual learning. To address these issues, we propose a modality-aware contrastive instance learning with self-distillation (MACIL-SD) strategy. Specifically, we leverage a lightweight two-stream network to generate audio and visual bags, in which unimodal background, violent, and normal instances are clustered into semi-bags in an unsupervised way. Then audio and visual violent semi-bag representations are assembled as positive pairs, and violent semi-bags are combined with background and normal instances in the opposite modality as contrastive negative pairs. Furthermore, a self-distillation module is applied to transfer unimodal visual knowledge to the audio-visual model, which alleviates noises and closes the semantic gap between unimodal and multimodal features. Experiments show that our framework outperforms previous methods with lower complexity on the large-scale XD-Violence dataset. Results also demonstrate that our proposed approach can be used as plug-in modules to enhance other networks. Codes are available at https://github.com/JustinYuu/MACIL_SD.","url_abs":"https://arxiv.org/abs/2207.05500v1","url_pdf":"https://arxiv.org/pdf/2207.05500v1.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":"abstracts"},"code_links":[{"paper_slug":"modality-aware-contrastive-instance-learning","repo_url":"https://github.com/JustinYuu/MACIL_SD","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"anomaly-detection-in-surveillance-videos","task_name":"Anomaly Detection In Surveillance Videos"},{"task_slug":"multiple-instance-learning","task_name":"Multiple Instance Learning"},{"task_slug":"audio-visual-learning","task_name":"audio-visual learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/anomaly-detection-in-surveillance-videos-on-2","task":"Anomaly Detection In Surveillance Videos","dataset":"XD-Violence","model":"MACIL_SD","rank_in_archive_order":10,"of":17,"metrics":{"AP":"83.4"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2207.05500","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2207.05500"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+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/JustinYuu/MACIL_SD","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":1,"ran_violates":1,"unverified":8},"by_repo_kind":{"official":{"samples":10,"ran":2,"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":0,"samples":[{"code_sha256_prefix":"d2d810cddae9f875","entry":"clones","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"Transformer.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/Transformer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d2d810cddae9f875"}},{"code_sha256_prefix":"55f1419d4d8c483c","entry":"transpose","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"InfoNCE.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/InfoNCE.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"55f1419d4d8c483c"}},{"code_sha256_prefix":"cc6bf655fc328b1a","entry":"Hbeta_torch","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"tSNE.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/tSNE.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cc6bf655fc328b1a"}},{"code_sha256_prefix":"d549060ffa0a0179","entry":"attention","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"Transformer.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/Transformer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d549060ffa0a0179"}},{"code_sha256_prefix":"54b175c46812e410","entry":"info_nce","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"InfoNCE.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/InfoNCE.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"54b175c46812e410"}},{"code_sha256_prefix":"6243210611bed58e","entry":"pad","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"utils.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6243210611bed58e"}},{"code_sha256_prefix":"e67350daa5b9bd57","entry":"pca_torch","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"tSNE.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/tSNE.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e67350daa5b9bd57"}},{"code_sha256_prefix":"88651357a6ab3451","entry":"random_extract","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"utils.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"88651357a6ab3451"}},{"code_sha256_prefix":"4b4b91623e8eb765","entry":"uniform_extract","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"utils.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4b4b91623e8eb765"}},{"code_sha256_prefix":"bd2165579e3dd449","entry":"x2p_torch","repo":"JustinYuu/MACIL_SD","repo_kind":"official","path":"tSNE.py","file_url":"https://github.com/JustinYuu/MACIL_SD/blob/HEAD/tSNE.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bd2165579e3dd449"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}