File size: 4,672 Bytes
c43bbe4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7643898
c43bbe4
 
 
9ffa9df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c43bbe4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b69ef78
c43bbe4
 
 
b69ef78
c43bbe4
 
 
 
 
 
 
 
 
9ffa9df
c43bbe4
 
 
 
b69ef78
 
 
 
9ffa9df
b69ef78
 
 
 
 
 
 
9ffa9df
 
b69ef78
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
library_name: pytorch
tags:
  - computer-vision
  - object-detection
  - image-classification
  - yolov7
  - marine-biology
pipeline_tag: object-detection
model-index:
  - name: YOLOv7 Baselines on N-MARINE
    results:
      - task:
          type: object-detection
          name: Object Detection
        dataset:
          type: other
          name: N-MARINE
          url: https://open.canada.ca/data/en/dataset/2ae46860-f82a-4127-bb1f-b02e36ef6a70
          split: test
          citation: |
            Morris, C. J., Ayyagari, K. D., Porter, D., Nguyen, Q. K., Hanlon, J., & Whidden, C. (2025).
            *Newfoundland Marine Refuge Fish Classification Dataset (N-Marine)*.
            Government of Canada Open Data Portal.
            https://open.canada.ca/data/en/dataset/2ae46860-f82a-4127-bb1f-b02e36ef6a70
        metrics:
          - name: "mAP@0.5"
            type: mAP
            value: 0.808
          - name: "mAP@0.5:0.95"
            type: mAP
            value: 0.494
          - name: precision
            type: precision
            value: 0.807
          - name: recall
            type: recall
            value: 0.764
---

# YOLOv7 Baselines for N-MARINE
This repo hosts baseline **YOLOv7** models trained on the **N-MARINE** dataset (North Atlantic underwater images with 9 fish species + background).

- **Best baseline (no class weights)**  
  mAP@0.5 **0.808 ± 0.007** · mAP@[0.5:0.95] **0.494 ± 0.008** · P **0.807 ± 0.036** · R **0.764 ± 0.014**
- **Paper:** TODO – add link when available
  
> Dataset: [N-MARINE](https://open.canada.ca/data/en/dataset/2ae46860-f82a-4127-bb1f-b02e36ef6a70)  
> Supplementary + scripts: https://github.com/Pentaerythrittetranitrat/N-MARINE_dataset_supplementary

## Model list
The released models follow this directory structure, where each `datasetX` (X = 1–5) corresponds to one of the five cross-validation splits:

Each `datasetX` directory contains two trained models:
- `classweights/best.pt` — trained with inverse-frequency class weights.  
- `no_classweights/best.pt` — trained without class weights (baseline, recommended).  

The **dataset splits** used for training can be found in the supplementary repository:  
[https://github.com/Pentaerythrittetranitrat/N-MARINE_dataset_supplementary](https://github.com/Pentaerythrittetranitrat/N-MARINE_dataset_supplementary)
> **Note:** The models under `dataset5` correspond to the most balanced split across classes.

Each model outputs **9 classes**. The **class order (index → class)** for all models is: 
| Index | Class name           |
|-------|----------------------|
| 0     | Atlantic Cod         |
| 1     | Roughhead Grenadier  |
| 2     | Atlantic Halibut     |
| 3     | Redfish Mentella     |
| 4     | Thorny Skate         |
| 5     | Striped Wolffish     |
| 6     | Spinytail Skate      |
| 7     | Whelk                |
| 8     | Northern Wolffish    |

## Intended use

- Benchmarking object detection on North Atlantic underwater imagery
- Studying class imbalance, visibility limits (turbidity/occlusion), and domain shifts
- Generating crops for downstream **species classification** tasks

## Training data and splits

- **Data:** N-MARINE (23,936 images, 9 species + background)
- **Split protocol:** fixed **15% video-level** test; 5-fold CV within train videos
- **Pretraining:** COCO weights (YOLOv7)
- **Image size:** 640×640 letterboxed
- **Epochs:** 50
- **Batch size:** 32
- **Other:** default YOLOv7 augmentations & hyperparams unless noted

### Class weights variant
Inverse-frequency class weights slightly improved **Spinytail Skate** but reduced aggregate mAP.

### Quick inference

> These weights are YOLOv7-format PyTorch checkpoints. Use the YOLOv7 repository or a compatible runner.

## CLI (YOLOv7)

```bash
# 1) Clone YOLOv7 (example URL; use the official repo you trained with)
git clone https://github.com/WongKinYiu/yolov7.git
cd yolov7
pip install -r requirements.txt

# 2) Run inference
python detect.py \
  --weights /path/to/N-MARINE_baseline_classifiers/n-marine_weights/dataset5/no_classweights/best.pt \
  --source /path/to/images_or_video \
  --img-size 640 \
  --conf-thres 0.25 \
  --iou-thres 0.65 \
  --save-txt --save-conf
```
### Citation

If you use the dataset, please cite:

Dataset citation (plain text):
Morris, C. J., Ayyagari, K. D., Porter, D., Nguyen, Q. K., Hanlon, J., & Whidden, C. (2025).
Newfoundland Marine Refuge Fish Classification Dataset (N-Marine).
Government of Canada Open Data Portal.
https://open.canada.ca/data/en/dataset/2ae46860-f82a-4127-bb1f-b02e36ef6a70

If you use the models, please cite:

Model citation (plain text):
TODO: Add