{"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/learning-prompt-enhanced-context-features-for","title":"Learning Prompt-Enhanced Context Features for Weakly-Supervised Video Anomaly Detection","arxiv_id":"2306.14451","date":"2023-06-26","proceeding":null,"authors":["Yujiang Pu","Xiaoyu Wu","Lulu Yang","Shengjin Wang"],"abstract":"Video anomaly detection under weak supervision presents significant challenges, particularly due to the lack of frame-level annotations during training. While prior research has utilized graph convolution networks and self-attention mechanisms alongside multiple instance learning (MIL)-based classification loss to model temporal relations and learn discriminative features, these methods often employ multi-branch architectures to capture local and global dependencies separately, resulting in increased parameters and computational costs. Moreover, the coarse-grained interclass separability provided by the binary constraint of MIL-based loss neglects the fine-grained discriminability within anomalous classes. In response, this paper introduces a weakly supervised anomaly detection framework that focuses on efficient context modeling and enhanced semantic discriminability. We present a Temporal Context Aggregation (TCA) module that captures comprehensive contextual information by reusing the similarity matrix and implementing adaptive fusion. Additionally, we propose a Prompt-Enhanced Learning (PEL) module that integrates semantic priors using knowledge-based prompts to boost the discriminative capacity of context features while ensuring separability between anomaly sub-classes. Extensive experiments validate the effectiveness of our method's components, demonstrating competitive performance with reduced parameters and computational effort on three challenging benchmarks: UCF-Crime, XD-Violence, and ShanghaiTech datasets. Notably, our approach significantly improves the detection accuracy of certain anomaly sub-classes, underscoring its practical value and efficacy. Our code is available at: https://github.com/yujiangpu20/PEL4VAD.","url_abs":"https://arxiv.org/abs/2306.14451v2","url_pdf":"https://arxiv.org/pdf/2306.14451v2.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":"learning-prompt-enhanced-context-features-for","repo_url":"https://github.com/yujiangpu20/pel4vad","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"anomaly-detection-in-surveillance-videos","task_name":"Anomaly Detection In Surveillance Videos"},{"task_slug":"video-anomaly-detection","task_name":"Video Anomaly Detection"},{"task_slug":"weakly-supervised-anomaly-detection","task_name":"Weakly-supervised Anomaly Detection"},{"task_slug":"weakly-supervised-video-anomaly-detection","task_name":"Weakly-supervised Video Anomaly Detection"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/anomaly-detection-in-surveillance-videos-on-1","task":"Anomaly Detection In Surveillance Videos","dataset":"ShanghaiTech Weakly Supervised","model":"PEL","rank_in_archive_order":1,"of":12,"metrics":{"AUC-ROC":"98.14"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-in-surveillance-videos-on","task":"Anomaly Detection In Surveillance Videos","dataset":"UCF-Crime","model":"PEL","rank_in_archive_order":8,"of":21,"metrics":{"ROC AUC":"86.76"},"uses_additional_data":false},{"leaderboard":"/sota/anomaly-detection-in-surveillance-videos-on-2","task":"Anomaly Detection In Surveillance Videos","dataset":"XD-Violence","model":"PEL","rank_in_archive_order":5,"of":17,"metrics":{"AP":"85.59"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2306.14451","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2306.14451"}},"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/yujiangpu20/pel4vad","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":9},"by_repo_kind":{"official":{"samples":9,"ran":0,"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":"6d53914a9cfb0d0e","entry":"CLAS2","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"loss.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/loss.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":true,"mcp_get_code":{"code_sha256":"6d53914a9cfb0d0e"}},{"code_sha256_prefix":"d19cc370f004029b","entry":"KLV_loss","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"loss.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/loss.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":true,"mcp_get_code":{"code_sha256":"d19cc370f004029b"}},{"code_sha256_prefix":"3da167d2f6c1fe65","entry":"build_config","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"configs.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/configs.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":true,"mcp_get_code":{"code_sha256":"3da167d2f6c1fe65"}},{"code_sha256_prefix":"39e6b23b55f376ea","entry":"build_model","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"prompt_extract/clip/model.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/prompt_extract/clip/model.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":"39e6b23b55f376ea"}},{"code_sha256_prefix":"e54688f4d92cf4e6","entry":"get_logger","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"log.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/log.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":true,"mcp_get_code":{"code_sha256":"e54688f4d92cf4e6"}},{"code_sha256_prefix":"6243210611bed58e","entry":"pad","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"utils.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/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":true,"mcp_get_code":{"code_sha256":"6243210611bed58e"}},{"code_sha256_prefix":"88651357a6ab3451","entry":"random_extract","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"utils.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/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":true,"mcp_get_code":{"code_sha256":"88651357a6ab3451"}},{"code_sha256_prefix":"5d4cc204c0da711e","entry":"temporal_smooth","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"loss.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/loss.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":true,"mcp_get_code":{"code_sha256":"5d4cc204c0da711e"}},{"code_sha256_prefix":"4b4b91623e8eb765","entry":"uniform_extract","repo":"yujiangpu20/pel4vad","repo_kind":"official","path":"utils.py","file_url":"https://github.com/yujiangpu20/pel4vad/blob/HEAD/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":true,"mcp_get_code":{"code_sha256":"4b4b91623e8eb765"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}