Views
No views yet
1from transformers import AutoProcessor, AutoModelForImageTextToText
2from PIL import Image
3
4model = AutoModelForImageTextToText.from_pretrained("munish0838/crop-burn-detector", torch_dtype="bfloat16", device_map="auto")
5processor = AutoProcessor.from_pretrained("munish0838/crop-burn-detector")
6
7rgb_image = Image.open("tile_rgb.png")
8swir_image = Image.open("tile_swir.png")
9
10messages = [
11 {"role": "system", "content": "You are an expert in analyzing Sentinel-2 satellite imagery for crop residue burning detection in northern India."},
12 {"role": "user", "content": [
13 {"type": "image", "image": rgb_image},
14 {"type": "image", "image": swir_image},
15 {"type": "text", "text": "Analyze this RGB + SWIR satellite tile and return a JSON burn assessment."},
16 ]},
17]
18
19inputs = processor.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
20out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
21print(processor.batch_decode(out, skip_special_tokens=True)[0])1{
2 "burn_detected": true,
3 "burn_severity": "moderate",
4 "burn_fraction_estimate": 0.25,
5 "burn_freshness": "recent",
6 "active_smoke_visible": false,
7 "vegetation_phase": "post_harvest",
8 "image_quality_limited": false,
9 "notes": "Dark brownish-red burn scars with rectangular field boundaries visible in SWIR."
10}| Base model | LiquidAI/LFM2.5-VL-450M |
| Training data | munish0838/crop-burn-detection-labeled |
| Train samples | 1,098 |
| Epochs | 5 |
| Learning rate | 0.0001 |
| LoRA rank | 16 |
| Effective batch | 16 |