GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - whynotnanfeng/MVLFireNet: Official PyTorch implementation of MVLFireNet: a lightweight forest fire detection model with multi-granularity vision-language enhancement (Fire 2026, 9, 409).

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
data
data
 
 
models
models
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
config.py
config.py
 
 
loss.py
loss.py
 
 
metrics.py
metrics.py
 
 
requirements.txt
requirements.txt
 
 
train.py
train.py
 
 
utils.py
utils.py
 
 

Repository files navigation

MVLFireNet

Official PyTorch implementation of A Lightweight Forest Fire Detection Model with Multi-Granularity Vision-Language Enhancement (Fire, 2026).

MVLFireNet is a real-time detector for UAV-based forest fire monitoring. It uses a compact ELAN + SPPF backbone, a top-down FPN with two task-specific modules, an RT-DETR style decoder, and a training-only vision-language branch.

  • Paper: https://www.mdpi.com/2571-6255/9/9/409
  • Dataset: FSDataset-VL (links below)
  • License: MIT

Results on FSDataset-VL

Model P R F1 [email protected] [email protected] [email protected]:0.95 FPS Params FLOPs
MVLFireNet 85.3 79.1 82.1 86.3 59.2 54.8 39.4 2.41 M 6.8 G

FPS is measured with batch size 1 on an RTX 3090. Parameters and FLOPs refer to the inference model; the MVLE branch is removed at inference.

Architecture

  • Backbone: ELAN-style blocks with an SPPF output stage, producing C3/C4/C5 features.
  • MSA (Multi-Scale Spatial-Aware attention): applied to P5. A self-attention branch is augmented by parallel depthwise convolutions with dilation rates 1, 3, and 5. Each scale has an independent learnable weight.
  • CMF (Cross-Modulation Fusion): replaces channel concatenation at the P4 and P3 fusion nodes. Two feature maps are compressed, then each branch generates grouped scale and bias factors for the other branch.
  • Head: RT-DETR decoder with 300 object queries, multi-scale deformable attention, query selection, and denoising training. Classification uses MAL; localization uses L1 and GIoU.
  • MVLE (Multi-Granularity Vision-Language Enhancement): a training-only branch. Global and local visual embeddings are aligned with LongCLIP text embeddings through InfoNCE. The branch is discarded at inference.

Dataset

FSDataset-VL extends FSDataset with global scene captions and local target captions. It contains 19,866 images and 41,983 bounding boxes.

  • Google Drive: https://drive.google.com/file/d/1evjqkbOR0rJnj33XlG4dDBfowXa0ZBXW/view
  • Quark: https://pan.quark.cn/s/ea37f9fe3bff?pwd=sf82 (code: sf82)

Expected layout:

datasets/FSDataset-VL/
├── images/
│   ├── train/
│   ├── val/
│   └── test/
└── captions/
    ├── train.json
    ├── val.json
    └── test.json

Each caption JSON file contains:

{
  "images": [
    {
      "image_id": 0,
      "file_name": "images/train/example.jpg",
      "global_caption": "A global scene description."
    }
  ],
  "annotations": [
    {
      "image_id": 0,
      "category_id": 0,
      "bbox": [0.5, 0.5, 0.2, 0.3],
      "local_caption": "A local target description."
    }
  ]
}

bbox is normalized [cx, cy, w, h]. category_id 0 is fire and 1 is smoke.

Installation

Python 3.10 is recommended. The paper uses PyTorch 2.4.1 with CUDA 11.8.

conda create -n mvlfirenet python=3.10 -y
conda activate mvlfirenet

pip install torch==2.4.1 torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu118
pip install -r requirements.txt

Download the LongCLIP text encoder used by MVLE:

python scripts/download_longclip.py

The weights are stored in weights/LongCLIP-KO-LITE/ by default. For users in mainland China, add --mirror.

Training

  1. Set the dataset path in config.py:
DATA_DIR = "/path/to/FSDataset-VL"

Alternatively, set the environment variable FSDATASET_VL_ROOT.

  1. Adjust devices if needed:
DEVICES = [0]          # [0, 1] for two GPUs
STRATEGY = "auto"      # "ddp" for multiple GPUs
BATCH_SIZE = 32        # per GPU
  1. Start training:
python train.py

Logs and checkpoints are written to lightning_logs/mvlfirenet/. The default schedule follows the paper: 300 epochs, 3 warmup epochs, 30 flat epochs, then cosine decay. Mosaic is enabled for epochs 0-283. MVLE is active for the whole run with a 3-epoch linear warmup.

Useful config entries:

Entry Meaning
DATA_DIR FSDataset-VL root
MVLE_TEXT_ENCODER_PATH LongCLIP directory
BATCH_SIZE / NBS Per-GPU batch size / nominal batch size
CACHE_IMAGES Cache decoded images in RAM
RESUME_CHECKPOINT Load model weights only
RESUME_TRAINING_CHECKPOINT Resume a full Lightning run

Inference

The released model does not need the text encoder or the MVLE branch. Build the inference model with:

import torch
from models.mvlfirenet import MVLFireNet

model = MVLFireNet(use_mvle=False)
checkpoint = torch.load("path/to/checkpoint.ckpt", map_location="cpu")
model.load_state_dict(checkpoint["state_dict"], strict=False)
model.eval()

outputs = model(images)          # images: [B, 3, 640, 640]
scores = outputs["pred_logits"].sigmoid().max(-1).values
boxes = outputs["pred_boxes"]    # normalized cxcywh

Keys belonging to mvle.* are absent from the inference model and can be ignored during loading.

Citation

@article{ma2026mvlfirenet,
  title   = {A Lightweight Forest Fire Detection Model with Multi-Granularity Vision-Language Enhancement},
  author  = {Ma, Yifan and Shan, Weifeng and Sui, Yanwei and Wang, Mengyu},
  journal = {Fire},
  volume  = {9},
  number  = {9},
  pages   = {409},
  year    = {2026},
  doi     = {10.3390/fire9090409}
}

License

This repository is released under the MIT License. See LICENSE.

The FSDataset-VL images inherit the terms of the original FSDataset. The LongCLIP weights are distributed under their own license.

About

Official PyTorch implementation of MVLFireNet: a lightweight forest fire detection model with multi-granularity vision-language enhancement (Fire 2026, 9, 409).

Topics

fire-detectionforest-firelightweight-modelobject-detectionpytorchremote-sensinguavvision-language

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.