unicornwhodev's picture
Update README.md
11b4793 verified
|
Raw History Blame Contribute Delete
5.37 kB
---
license: bsd-3-clause
tags:
- fireviewer
- convnext
- torchvision
- fire
- smoke
- image-classification
library_name: pytorch
pipeline_tag: image-classification
datasets:
- fireviewer/fireviewer_fire_smoke_flame_v3_native
model-index:
- name: FireViewer ConvNeXt-Tiny · Context
results:
- task:
type: image-classification
name: Image Classification
dataset:
type: fireviewer/fireviewer_fire_smoke_flame_v3_native
name: FireViewer · labelled validation subset
config: default
split: validation
revision: 8c8b197fa1c928217529a04bff434fb70a66614e
metrics:
- type: f1
name: F1 macro (%)
value: 76.92
- type: accuracy
name: Accuracy (%)
value: 87.72
---
![FireViewer · ConvNeXt-Tiny · Six visual contexts](assets/card-header.svg)
# ConvNeXt-Tiny · Six visual contexts
An image-level classifier with **six context outputs**. Targets come from the Luna context annotations of the FireViewer corpus. It predicts one category for the whole image, without bounding boxes.
| Input | Validation macro F1 | Validation accuracy |
|---|---:|---:|
| **920 × 920 RGB** | **76.92%** | **87.72%** |
## Checkpoint and class order
[`best.pth`](best.pth) is the selected validation checkpoint. [architecture.json](architecture.json) records the Torchvision architecture and initialization; [class_mapping.json](class_mapping.json) fixes the output order.
| ID | Category | Interpretation |
|---:|---|---|
| 0 | `human_useful_fire` | Controlled human use |
| 1 | `domestic_origin` | Domestic context |
| 2 | `suspect_origin` | Undetermined or insufficient origin detail |
| 3 | `fire_road_urban` | Road / urban |
| 4 | `forest_natural_area_wildfire` | Apparent uncontrolled vegetation fire |
| 5 | `negative` | No visible fire or smoke |
These are visual-context categories, **not an ordinal severity scale**. `suspect_origin` does not establish criminal intent; it covers insufficient origin information or detail with potentially hazardous fire or smoke. One image can contain multiple contexts even though the model returns one class.
## Validation results
![Class F1, macro F1 and accuracy on the labelled validation subset](assets/validation-summary.png)
The best checkpoint is evaluated at **epoch 5 on 11,237 validation images with a context label**. Prediction is the highest of six logits.
| Category | Precision | Recall | F1 | Images |
|---|---:|---:|---:|---:|
| `human_useful_fire` | 62.39% | 78.46% | 69.51% | 260 |
| `domestic_origin` | 47.46% | 58.33% | 52.34% | 48 |
| `suspect_origin` | 74.71% | 75.26% | 74.98% | 2,292 |
| `fire_road_urban` | 88.35% | 84.57% | 86.42% | 1,121 |
| `forest_natural_area_wildfire` | 80.20% | 87.47% | 83.68% | 1,181 |
| `negative` | 95.76% | 93.43% | 94.58% | 6,335 |
Macro F1 gives equal weight to all six classes; accuracy is more influenced by frequent classes. The domestic class has only **48 validation images**, so a few errors can materially change its score. These values measure agreement with Luna labels, not independent real-world danger assessment or held-out test performance.
## PyTorch inference
```bash
pip install torch torchvision pillow huggingface_hub
```
```python
import torch
from PIL import Image
from torch import nn
from torchvision.models import convnext_tiny
from torchvision.transforms import functional as TF
from huggingface_hub import hf_hub_download
path = hf_hub_download(
"fireviewer/convnext-tiny-alert-categories-v2",
"best.pth",
)
checkpoint = torch.load(path, map_location="cpu", weights_only=False)
labels = checkpoint["classes"]
size = int(checkpoint["image_size"])
model = convnext_tiny(weights=None)
model.classifier[2] = nn.Linear(model.classifier[2].in_features, len(labels))
model.load_state_dict(checkpoint["model"])
model.eval()
with Image.open("image.jpg") as image:
image.draft("RGB", (size, size))
image = image.convert("RGB").resize((size, size), Image.Resampling.BILINEAR)
tensor = TF.normalize(
TF.to_tensor(image),
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
).unsqueeze(0)
with torch.inference_mode():
logits = model(tensor)
category = labels[int(logits.argmax(dim=1).item())]
print(category)
```
Preprocessing is RGB, direct bilinear resizing to **920 × 920**, pixels in `[0,1]`, followed by ImageNet normalization: mean `[0.485,0.456,0.406]`, standard deviation `[0.229,0.224,0.225]`. It does not use YOLO letterboxing.
## Use, rights and limitations
Use the model to explore, filter or group images by visual context. It does not locate objects, estimate camera-to-fire distance or determine the historical cause of an incident. Ambiguous scenes and camera, illumination or environment shifts can reduce performance.
Declared licence: **BSD-3-Clause**. Image rights are described separately in the [dataset card](https://huggingface.co/datasets/fireviewer/fireviewer_fire_smoke_flame_v3_native). Evaluated weights originate from revision `12dd4da71da5dd4264c63e07cab5f41c3a007b77`; the earlier package identity remains in its provenance. This English presentation does not change the checkpoint.
[FireViewer](https://huggingface.co/fireviewer) · [Resource catalogue](https://huggingface.co/spaces/fireviewer/README/blob/main/docs/RESOURCE_INDEX.md) · Presentation updated **14 November 2026**.