File size: 1,207 Bytes
a7627f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
tags:
- object-detection
- faster-rcnn
- multispectral
- canopy-detection
- remote-sensing
library_name: pytorch
pipeline_tag: object-detection
---

# 🌳 Faster R-CNN 6-Band Canopy Detection

**Faster R-CNN ResNet50-FPN v2** trained on 6-band multispectral satellite imagery for tree canopy detection.

## Model Details

| Property | Value |
|----------|-------|
| Backbone | ResNet50-FPN v2 (COCO pretrained) |
| Input | 6 channels (B, G, R, RE, NIR1, NIR2) |
| Classes | 1 (canopy) |
| Image size | 640×640 |
| Best mAP@50 | 0.9735 |
| Parameters | ~43M |

## Auto-Detect Band Support

| Input Format | Band Mapping |
|---|---|
| 3-band (RGB) | [R, G, B, 0, 0, 0] |
| 5-band | [B, G, R, RE, NIR1, 0] |
| 6-band | Direct input |
| 7-band | Drop Band 7 (anomalous NIR3) |

## Usage

```python
import rasterio, numpy as np, torch
from torchvision.models.detection import fasterrcnn_resnet50_fpn_v2

# Load model (modify first conv for 6 channels)
model = ...  # See training notebook for full setup
model.load_state_dict(torch.load('best.pt'))
model.eval()

# Load & preprocess
with rasterio.open('tile.tif') as src:
    img = src.read()  # (C, H, W)
# Map to 6 channels, normalize, run inference
```