๐ฅ LAVAD: Training-Free Video Anomaly Detection with LLMs
๐ฅ LAVAD: Training-free Video Anomaly Detection with LLM!
LA-VAD = LAnguage-based Video Anomaly Detection. In other words, language model-based video anomaly detection!!
- Title: Harnessing Large Language Models for Training-free Video Anomaly Detection
- Conference: CVPR 2024
- Code/Checkpoints: GitHub โ LAVAD, Project
- Key Keywords:
Training-Free
,Video Anomaly Detection
,LLM
,VLM
,Zero-Shot
- Summary: Combines pre-trained Vision-Language Models (VLM) and Large Language Models (LLM) to perform video anomaly detection without any additional training (training-free) โ the first approach of its kind!
๐ LAVAD Core Summary
One-liner: โEven without a training dataset, LLMs and VLMs can catch anomalies in video!โ
1) Training-Free Zero-Shot VAD
- Previous VAD required one-class training or unsupervised training.
- LAVAD performs anomaly detection without any retraining, purely with pre-trained models.
2) VLM-based Caption Generation
- Each video frame is captioned by a VLM โ text description.
- Example: โA person is walkingโ, โA person is fightingโ.
3) LLM for Anomaly Detection
- LLM takes the caption sequence and classifies normal vs anomalous behavior.
- Uses temporal reasoning + prompts to calculate anomaly scores.
4) Noise Reduction & Refinement
- Cleans noisy captions via cross-modal similarity.
- Stabilizes frame-level scores through temporal smoothing.
๐ Background in Previous Work
- Video Anomaly Detection (VAD): usually relies on one-class training with only normal videos, or weak supervision.
- Videos are sequences of images (frames).
- Traditional VAD calculates anomaly scores per frame (I).
- Dataset labels take the form (V, y):
- Fully-supervised: y is a vector like [0,0,0,1,0โฆ] (per-frame labels).
- Weakly-supervised: y is a single 0/1 label for the entire video.
- One-Class: y only includes normal data; unseen behaviors are considered anomalous.
- Limitations: hard to collect datasets, and retraining is needed whenever adapting to new domains/environments.
- Rise of LLMs (e.g., ChatGPT) and strong VLMs opened a new path!
So what if we just plug VLM + LLM into VAD??
- Instead of binary classification, ask the LLM to assign anomaly scores (11 levels: 0.0โ1.0).
Equation (1): ฮฆLLMโ(P_CโโP_FโโฮฆCโ(I))
- P_C: context prompt
- example: โIf you were a law enforcement agency, how would you rate the scene described on a scale from 0 to 1, with 0 representing a standard scene and 1 denoting a scene with suspicious activities?โ
- P_F: formatting prompt to control output format
- example: โPlease provide the response in the form of a Python list โฆ choose only one number from [0, 0.1, โฆ, 1.0].โ
- โฆ : text concatenation
- ฮฆC: captions from the VLM
- P_C: context prompt
- Does this Equation (1) method work?
๐งฑ LAVAD Architecture
- Five key components:
- ฮฆC : VLM-generated captions (image โ text)
- ฮฆLLM : LLM (text reasoning)
- E_I : image encoder (image โ vector)
- E_T : text encoder (text โ vector)
- E_V : video encoder (video โ vector)
- D_C : set of captions across the whole video
- C^_i : captions collected around frame i
- S : temporally enriched caption summary
- Three modules address unsupervised VADโs main issues:
i) Image-Text Caption Cleaning โ denoise captions using E_I & E_T similarity
ii) LLM-based Anomaly Scoring โ use ฮฆLLM with temporal windows for anomaly score
iii) Video-Text Score Refinement โ refine anomaly scores via E_VโE_T similarity
i) Image-Text Caption Cleaning
- Generate captions C from ฮฆC per frame โ noisy.
- Use all video captions, embed them with E_T.
- Find the caption most similar (via cosine similarity) to the frameโs E_I embedding.
- Note: this is offline VAD (full video available), so global captions can be used.
- Build the refined caption set (\hat{C}).
ii) LLM-based Anomaly Scoring
- Captions (\hat{C}_i) describe the scene but lack temporal context.
- Solution: use LLM to summarize captions from a T-second window around frame i (C^_i).
- Prompt: โPlease summarize what happened in few sentences, based on the following temporal description of a scene. Do not include any unnecessary details or descriptions.โ
- The resulting summary S_i is fed to the LLM again to estimate anomaly score a_i.
iii) Video-Text Score Refinement
- Now we have frame-level anomaly scores a_i, but only from LLM reasoning.
- Encode the video snippet V_i (around frame i) with E_V.
- Encode summary S_i with E_T.
- Use their similarity to refine anomaly score (\tilde{a}_i).
- Essentially: find top-K most similar (video, text) pairs and weight their scores.
- Weighted averaging of similar neighbors โ stable final anomaly scores.
๐งช Experiments & Results
Setup
- VLM: BLIP-2
- LLM: Llama-2-13b-chat
- Multimodal encoders (E_I, E_T, E_V): ImageBind, temporal window T=10s
- Datasets:
- UCF-Crime: 1900 surveillance videos, 13 anomaly classes. Evaluated with AUC-ROC & AP.
- XD-Violence: 4754 videos, 6 anomaly classes.
Results
- Achieves SOTA among training-free methods.
- Still lags behind supervised baselines.
Ablation
A. All three components are crucial:
i) Image-Text Caption Cleaning
ii) LLM-based Anomaly Scoring
iii) Video-Text Score Refinement- B. Prompt priors experiment:
- Base prompt: โHow would you rate the scene described on a scale from 0 to 1, with 0 representing a standard scene and 1 denoting a scene with suspicious activities?โ
- Add anomaly prior: โor potentially criminal activitiesโ โ little effect.
- Add impersonation: โIf you were a law enforcement agencyโฆโ โ best (+0.96% AUC).
- Both priors โ no further improvement.
- C. Effect of K (neighbors in refinement):
- Larger K improves performance until saturating around K=9.
- No caption cleaning = sharp performance drop.
- LLM reasoning clearly improves anomaly score quality.
- Outperforms keyword-matching baselines significantly.
โ Conclusion
- LAVAD is the first training-free video anomaly detection framework.
- Combines VLM + LLM to detect anomalies without any training data.
- Promising for surveillance, security, and safety-critical systems.
- As multimodal LLMs advance, performance and scalability will improve further.
๐ก My Takeaways
- Extending LAVAD to real-time video streams would be very valuable.
- Inference speed (fps) may be a bottleneck.
- A fun and impactful training-free research direction!
๐ฅ (ํ๊ตญ์ด) LAVAD: ํ์ต ์์ด ์์ ์ด์ ๊ฐ์ง๊น์ง, LLM์ด ํด๋ธ๋ค!
LA-VAD = LAnguage-based Video Anomaly Detection. ์ฆ, ์ธ์ด๋ชจ๋ธ ๊ธฐ๋ฐ์ ๋น๋์ค ์ด์ํ์ง!!
- ์ ๋ชฉ: Harnessing Large Language Models for Training-free Video Anomaly Detection
- ํํ: CVPR 2024
- ์ฝ๋/์ฒดํฌํฌ์ธํธ: GitHub โ LAVAD, Poroject
- ํต์ฌ ํค์๋:
Training-Free
,Video Anomaly Detection
,LLM
,VLM
,Zero-Shot
- ์์ฝ: ์ฌ์ ํ์ต๋ Vision-Language Model(VLM)๊ณผ Large Language Model(LLM)์ ๊ฒฐํฉํด, ์ถ๊ฐ ํ์ต ์์ด(training-free) ์์ ๋ด ์ด์ ํ๋์ ํ์งํ๋ ์ต์ด์ ์ ๊ทผ!
๐ LAVAD ํต์ฌ ์์ฝ
ํ ์ค ์์ฝ: โํ๋ จ๋ ๋ฐ์ดํฐ์ ์์ด๋, LLM๊ณผ VLM์ผ๋ก ๋น๋์ค ์ ์ด์ ์ํฉ์ ์ก์๋ธ๋ค!โ
1) Training-Free Zero-Shot VAD
- ๊ธฐ์กด VAD๋ one-class ํ์ต์ด๋ unsupervised ํ์ต์ด ํ์ํ์
- LAVAD๋ ์ถ๊ฐ ํ๋ จ ์ ํ ์์ด, ์ฌ์ ํ์ต๋ ๋ชจ๋ธ๋ง์ผ๋ก ์ด์ ๊ฐ์ง ์ํ
2) VLM ๊ธฐ๋ฐ ์บก์ ์์ฑ
- ์ ๋ ฅ ์์ ํ๋ ์์ VLM์ด ์ค๋ช โ ํ ์คํธ ์บก์ ์์ฑ
- ์: โA person is walkingโ, โA person is fightingโ
3) LLM ํ์ฉ ์ด์ ๊ฐ์ง
- LLM์ด ์บก์ ์ํ์ค๋ฅผ ๋ฐ์, ์ ์ vs ์ด์ ํ๋ ๋ถ๋ฅ
- ์๊ฐ์ ๋งฅ๋ฝ ์ดํด + prompt ๊ธฐ๋ฐ reasoning์ผ๋ก anomaly score ๊ณ์ฐ
4) ์ ์ ๋จ๊ณ (Noise Reduction)
- ์บก์ ๋ ธ์ด์ฆ โ cross-modal similarity๋ก ์ ๊ฑฐ
- frame-level anomaly score โ temporal smoothing์ผ๋ก ์์ ํ
๐ ๊ธฐ์กด ์ฐ๊ตฌ์ ํ๋ฆ
- Video Anomaly Detection(VAD): ์ฃผ๋ก ๋๊ท๋ชจ ์ ์ ์์์ผ๋ก one-class ํ๋ จ, ๋๋ weakly supervised ๋ฐฉ์ ํ์ฉ
- ๋น๋์ค๋ ์ด๋ฏธ์ง๊ฐ ๊ณ์ ์ด์ด์ง!
- ์ ํต์ ์ธ VAD๋ ๊ฐ Frame๋ณ ์ด๋ฏธ์ง I์ ๋ํด anomalous Score๋ฅผ ๊ตฌํจ
- ์ด๋ฅผ ํตํด์ ๋ฐ์ดํฐ Label์ (V,y) ํ์์ผ๋ก ๊ตฌ์ฑ๋จ (๋น๋์ค, label)
- Fully-supervised : y ๋ [0,0,0,1,0โฆ] ๊ณผ ๊ฐ์ด ํ๋ ์๋ณ ๊ฒฐ๊ณผ ์ ์
- Weakly-supervised : y ๋ 0 ํน์ 1๋ก ๋น๋์ค ์ ์ฒด์ ๋ํ ํ๋จ๋ง ์ ์
- One-Class : y๋ ์ ์์ธ๊ฒ๋ง ์์ (์ ์์ธ๊ฒ๋ง ๋ค ํ์ตํด์, ๋ชป๋ณด๋ ์ํฉ์ด๋ฉด ์ด์์ผ๋ก!!)
- ์ ๋ฐฉ์๋ค์ ํ๊ณ: ๋ฐ์ดํฐ์ ๊ตฌํ๊ธฐ ํ๋ค ๋ฟ๋ง ์๋๋ผ ์๋ก์ด ํ๊ฒฝ/๋๋ฉ์ธ์ ์ ์ฉํ๋ ค๋ฉด ํญ์ ๋ค์ ํ์ต ํ์
- LLM์ ๋ฐ์ : ChatGPT๋ก ์์๋์ด ์ฌ๋ฌ LLM์ด ๋ฐ์ ํจ. VLM๋ ์ข์ ์ฑ๋ฅ!!
๊ทธ๋ผ! ๊ทธ๋ฅ ๋ฐ๋ก VLM๊ณผ LLM์ ๊ฐ์ ธ๋ค๊ฐ VAD์ ์จ๋ณด๋ฉด ์ด๋จ๊น??
- LLM์๊ฒ ์บก์ ์ ์ฃผ๊ณ , ์ ์/์ด์์ ํ๋จํ๋ Classification์ด ์๋, ์ด์ ์ ์(anomaly score) ์ธก์ฑ์ ์์ฒญ - ์ ์๋ 11๋จ๊ณ(0.0~1.0)๋ก ๋๋จ
Equation(1) - ฮฆLLMโ(P_CโโP_FโโฮฆCโ(I))
- P_C : ์ํฉ ๋งฅ๋ฝ ํ๋กฌํฌํธ
- example : โโIf you were a law enforcement agency, how would you rate the scene described on a scale from 0 to 1, with 0 representing a standard scene and 1 denoting a scene with suspicious activities?โ
- P_F : LLM์๊ฒ ์ผ์ ํ์์ output์ ์์ฒญํ๋ ํ๋กฌํฌํธ
- example: โPlease provide the response in the form of a Python list โฆ choose only one number from [0, 0.1, โฆ, 1.0].โ
- โฆ : ํ ์คํธ ์ฐ๊ฒฐ
- ฮฆC : VLM์์ ๋์จ ์บก์
- P_C : ์ํฉ ๋งฅ๋ฝ ํ๋กฌํฌํธ
- ์ด Equation (1) ์ ๋ฐฉ๋ฒ์ผ๋ก ํ๋ฉด ์๋ ๊น!?
๐งฑ LAVAD ๊ตฌ์กฐ (Architecture)
- ๋ค์ฏ๊ฐ์ง ์ฃผ์ ์์๋ก ๊ตฌ์ฑ๋๋ค!!
- ฮฆC : VLM์์ ๋์จ ์บก์ . ์ด๋ฏธ์ง๋ฅผ ํ ์คํธ๋ก.
- ฮฆLLM : LLM. ํ ์คํธ๋ฅผ ํ ์คํ.
- E_I : ์ด๋ฏธ์ง ์ธ์ฝ๋. ์ด๋ฏธ์ง๋ฅผ ๋ฒกํฐ๋ก.
- E_T : ํ ์คํธ ์ธ์ฝ๋. ํ ์คํธ๋ฅผ ๋ฒกํฐ๋ก.
- E_V : ๋น๋์ค ์ธ์ฝ๋. ๋น๋์ค๋ฅผ ๋ฒกํฐ๋ก.
- D_C : ์์ ์ ์ฒด ํ๋์์ ์บก์ ์ ์งํฉ
- C^_i : i ํ๋ ์์์ ์ ํ๋ก ์บก์ ๋ฐ์์ ๋ชจ์๊ฒ
- S : ๋งฅ๋ฝ์ ๋ณด๊ฐ ๋ฐ์๋ ์บก์
- ์ด์ ์๋์ 3๊ฐ ์์๊ฐ ์์ ๋ณด์๋ Unsupervised์ ๋ฌธ์ ์ ์ ํด๊ฒฐํด์ค๋ค!
i) Image-Text Caption Cleaning: E_I์ E_T๋ฅผ ํตํธ ์ด๋ฏธ์ง ํ ์คํธ ์บก์ ์ ์
ii) LLM-based Anomaly Scoring: ฮฆLLM์ ํตํด ์๊ฐ์ ์ ๋ณด๋ฅผ ์ธ์ฝ๋ฉํ์ฌ ์ด์ ์ ์ ์ฐ์ถ
iii) Video-Text Score Refinement: E_V์ E_T๋ฅผ ์ฌ์ฉํ ๋น๋์ค-ํ ์คํธ ์ ์ฌ๋๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ ์ด์ ์ ์ ๋ณด์
i) Image-Text Caption Cleaning
- ๋น๋์ค์์ ํ๋ ์๋ณ๋ก ฮฆC๋ฅผ ํ์ฉ, ์บก์ (C)์ ๋ง๋ฌ -> ์์ ๋ณธ๊ฒ์ฒ๋ผ noisy ํ๊ฒ ์ง?
- ์ด ์ก์ ์ ๊ฑฐ๋ฅผ ์ํด ์ ์ฒด ํ๋ ์์ ์บก์ ์ ๊ฐ์ ธ์์, E_T ๋ก ๋ฒกํฐ๋ฅผ ๋ฝ๊ณ
- E_I๋ก ์ฐ์ถ๋ ํด๋น ํ๋ ์ ์ด๋ฏธ์ง์ ๊ฐ์ฅ cosine similarity๊ฐ ๋์ ํ๋์ ์บก์ ์ ๋ฝ๋๋ค.
- ์ฐธ๊ณ : ์ค์๊ฐ ์์๋ถ์์ด ์๋๋ผ ํ ์คํธ ๋น๋์ค ์ ์ฒด๋ฅผ ์ด๋ฏธ ๊ฐ์ง๊ณ ์๋คโ๋ offline VAD ์ํฉ์. ๊ทธ๋์ ์ ์ฒด ์บก์ ์งํฉ ์ฌ์ฉ์ด ๊ฐ๋ฅํจ!
- ๊ฒฐ๊ตญ ์ ์ฒด ํ๋ ์์ ๋ํด์ ์ ์ ๋ ์บก์ ์งํฉ C_i ๋ฅผ ํ๋ณดํจ
ii) LLM-based Anomaly Scoring
- C_i ๊ฐ ์ฅ๋ฉด์ ๋ณด๊ฐ ์์ง๋ง, ์ํฉ์ ๋ํ ์ ๋ณด๋ ์๋ค!
- ๊ทธ๋์ LLM์ผ๋ก ์์ฝํ๋ค. ํ ํ๋์ ์ ํ์ T์ด๋ฅผ window๋กํด์, ํ ์ํฉ์์์ ์ํฉ์ ๋ณด๋ฅผ ๋ฐ๋๋ค.(C^_i)
- ํ๋กฌํฌํธ๋!! โPlease summarize what happened in few sentences, based on the following temporal description of a scene. Do not include any unnecessary details or descriptions.โ
- ์ด๋ฅผ ํตํด์ ํํ๋ ์ i ์์์ ๋ฌ์ฌ๋ฅผํ S_i ๋ฅผ ๋ค์ LLM์ ๋ฃ์ด์ anomaly score(a)๋ฅผ ๊ตฌํ๋ค.
iii) Video-Text Score Refinement
- ์ด์ , ํ๋ ์๋ณ ์ ์ a๊ฐ ๋์์ง๋ง, ์ด๋ LLM์ ํตํ๊ฑฐ์ผ.
- ๋น๋์ค ์ธ์ฝ๋ E_V๋ฅผ ํตํด์ i ํ๋ ์ ์ค์ฌ์ ์์์ ์ธ์ฝ๋ฉํ๊ณ ,
- ํ ์คํธ ์ธ์ฝ๋ E_T๋ฅผ ํตํด์ S_i๋ฅผ ์ธ์ฝ๋ฉํ ๊ฐ์ผ๋ก ๋ค์ ํ๋ฒ ์ ์ a~_i๋ฅผ ๊ตฌํ๋ค.
- ๊ทธ๋์! i ํ๋ ์์ ์ ํ ๋น๋์ค์ธ์ฝ๋ฉ๊ฐ์ด๋ ์ ํ์ ํ ์คํธ ์ธ์ฝ๋ฉ ์ ์ฌ๋๋ฅผ ๊ตฌํด์,
- ํด๋น ์ ์ฌ๋๋ฅผ ๊ฐ์คํ๊ท ํด์ a~_i ๋ค์ ๋ํ๋ค!! ์ด๋ฅผ ํตํด ์ต์ข ์ ์๋ฅผ ์ฐ์ถ!!
๐งช ์คํ ๋ฐ ๊ฒฐ๊ณผ ๋ถ์
๐งช ์คํ ์๊ฑด
- ์คํ ์ธ๋ถ์ฌํญ!!
- VLM์ BLIP-2 ์ฌ์ฉ
- LLM์ Llama-2-13b-chat ์ฌ์ฉ
- ๋ฉํฐ๋ชจ๋ฌ ์ธ์ฝ๋(์ด๋ฏธ์ง,ํ ์คํธ,๋น๋์ค)๋ ImageBind ์ฌ์ฉ, ์๊ฐ window๋ 10์ด!
- ๊ธฐ์กด์ VAD์ฉ ๋ฐ์ดํฐ์
์ธ UCF-Crime and XD-Violence ํ์ฉ, AUC-ROC ์งํ๋ก ํ๊ฐ
- UCF-Crime : 1900๊ฐ์ ์ค์ ์ํฉ ๊ฐ์์นด๋ฉ๋ผ ๋น๋์ค, 13๊ฐ์ง์ ์ด์ํด๋์ค๊ฐ ์กด์ฌ. AUC-ROC + Average Precision(AP) ๋ ๋ค ํ๊ฐ
- XD-Violence : 4754 ๋น๋์ค. 6๊ฐ์ ์ด์ํด๋์ค ์กด์ฌ.
๐งช ์คํ ๊ฒฐ๊ณผ
- Training-Free์ค์์๋ ์ต๊ณ ๋ค!!
- ๋ค๋ง, Supervised์ ๋นํด์๋ ์์ข๋ค!
๐งช Ablation ๋ถ์
A. ์๋ ์ธ๊ฐ์ง ์์๋ ๋ชจ๋ ์ค์ํ๋ค!!
i) Image-Text Caption Cleaning
ii) LLM-based Anomaly Scoring
iii) Video-Text Score Refinement- B. ํ๋กฌํฌํธ๊ฐ ์ค์ํ ๊น?์ ๋ํ ์คํ
- 1๋ฒ์จฐ ์ค์ ์ ์ผ ๊ธฐ๋ณธ : How would you rate the scene described on a scale from 0 to 1, with 0 representing a standard scene and 1 denoting a scene with suspicious activities?
- 2๋ฒ์จฐ ์ค์ โor potentially criminal activities ์ถ๊ฐ
- 3๋ฒ์จฐ ์ค์ โIf you were a law enforcement agency,โ ์ถ๊ฐ
- 4๋ฒ์งธ ์ค์ ๋ชจ๋ ์ถ๊ฐ!!
- ์ ๊ธฐํ๊ฒ๋ 3๋ฒ์จฐ๊ฐ ์ฑ๋ฅ์ด ์ ์ผ ์ข์๋ค! ์๋ง๋ ๋๋ฌด ์ ์ฝ์ด ๋ง์ผ๋ฉด ํ๊ณ๊ฐ ์์์๋..
- C. window K์ ๋ํ ๋ถ์
- ๋ ธ์ด์ฆ ์ ์ ๋จ๊ณ ์์ผ๋ฉด ์ฑ๋ฅ ๊ธ๋ฝ
- LLM reasoning์ด anomaly score ํ์ง์ ํฐ ๊ธฐ์ฌ
- ๋จ์ ํค์๋ ๋งค์นญ ๋ฐฉ์ ๋๋น ์๋ฑํ ๋์ ์ ํ๋
โ ๊ฒฐ๋ก
- LAVAD๋ ์ต์ด์ Training-Free Video Anomaly Detection ํ๋ ์์ํฌ
- VLM๊ณผ LLM์ ์กฐํฉํด, ํ๋ จ ๋ฐ์ดํฐ ์์ด๋ ์ค์๊ฐ ์ด์ ํ๋ ํ์ง ๊ฐ๋ฅ
- ๊ฐ์, ๋ณด์, ์์ -critical ์์คํ ๋ฑ์์ ์ฆ๊ฐ์ ํ์ฉ ๊ฐ๋ฅ์ฑ
- ์์ผ๋ก ๋ ๊ฐ๋ ฅํ ๋ฉํฐ๋ชจ๋ฌ LLM์ด ๋ฑ์ฅํ๋ฉด ์ฑ๋ฅยทํ์ฅ์ฑ์ ๋์ฑ ์ปค์ง ์ ๋ง!
๋ด ์ถ๊ฐ์๊ฐ!!
- ์ค์๊ฐ ์์์ ๋ํ ๋ถ์๋ ํด๋ฉด ๋ ์ข๊ฒ ๋ค!!
- fps๊ฐ ์์ฒญ ์๋์ค๊ณ๋๊ฑธ
- ์ฌ๋ฏธ์๋ TF์ฐ๊ตฌ๋ค!