Base model: LiquidAI/LFM2.5-VL-1.6B fine-tuned on the UCF Crime dataset for surveillance crime detection.
Fine-tuned 2× faster with
Unsloth on ~26k surveillance images — entirely on a
free Google Colab T4 GPU.
1{
2 "isHarm": true,
3 "descriptionIfHarm": "The image depicts fighting."
4}
The full UCF Crime dataset has ~600k images (1,900+ CCTV videos). Training on the full set would take weeks on a free T4, so a balanced subset of 26k images (1,000 per crime class + equal normal samples) was used.
Evaluated against the base model using an LLM judge on a held-out test set.
1from unsloth import FastVisionModel
2from PIL import Image
3
4model, tokenizer = FastVisionModel.from_pretrained(
5 model_name="rajofearth/lfm-ucf-unsloth",
6 max_seq_length=2048,
7 load_in_4bit=False,
8 attn_implementation="eager",
9)
10FastVisionModel.for_inference(model)
11
12image = Image.open("your_surveillance_image.jpg").convert("RGB")
13
14system_prompt = """Analyze this frame with extreme caution. Detect ANY potential harm.
15If ANY doubt, flag as harmful. Reply ONLY in strict JSON:
16{"isHarm": true/false, "description": "brief exact reason only if true, else null"}. No explanations outside JSON."""
17
18messages = [
19 {
20 "role": "user",
21 "content": [
22 {"type": "text", "text": system_prompt},
23 {"type": "image", "image": image}
24 ]
25 }
26]
27
28prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
29inputs = tokenizer(text=prompt, images=image, return_tensors="pt").to("cuda")
30
31outputs = model.generate(**inputs, max_new_tokens=128, temperature=0.2)
32input_len = inputs["input_ids"].shape[1]
33print(tokenizer.decode(outputs[0][input_len:], skip_special_tokens=True))
1from transformers import AutoProcessor, AutoModelForVision2Seq
2from peft import PeftModel
3
4base = AutoModelForVision2Seq.from_pretrained("LiquidAI/LFM2.5-VL-1.6B")
5model = PeftModel.from_pretrained(base, "rajofearth/lfm-ucf-unsloth")
6processor = AutoProcessor.from_pretrained("LiquidAI/LFM2.5-VL-1.6B")
Want to train this yourself or adapt it to your own surveillance dataset? The full training notebook is free and public:
Developed by: rajofearth · Created with Unsloth + Google Colab (free tier).