File size: 2,324 Bytes
e7f4542
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
tags:
- fathomnet
- marine-biology
- ocean
- underwater-imagery
- object-detection
- fish
---

# megafishdetector

Detector for generic "fish" trained on publicly available datasets, currently supporting YOLO-style bounding boxes prediction and training. Can also be used as pre-trained networks for further fine-tuning.

Initial experiments to train a generic MegaFishDetector modelled off of the MegaDetector for land animals (https://github.com/microsoft/CameraTraps/blob/main/megadetector.md)

Currently based on YOLOv5 (https://github.com/ultralytics/yolov5).

This repo contains links to public datasets, code to parse datasets into a common format (currently YOLO darknet only), and a model zoo for people to start with. For instructions to run, see the link above.

## Instructions
1. Install [Yolov5](https://github.com/ultralytics/yolov5)
2. Download desired network [weights](https://github.com/warplab/megafishdetector/blob/main/MODEL_ZOO.md)
3. Usage (from yolov5 root): python detect.py --imgsz 1280 --conf-thres 0.1  --weights [path/to/megafishdetector_v0_yolov5m_1280p] --source [path/to/video/image folder]

## Public Datasets Used in v0:

- [AIMs Ozfish](https://github.com/open-AIMS/ozfish) 
- [FathomNet](https://www.fathomnet.org/)
- [VIAME FishTrack](https://viame.kitware.com/#/collection/62afcb66dddafb68c8442126)
- [NOAA Puget Sound Nearshore Fish (2017-2018)](https://lila.science/datasets/noaa-puget-sound-nearshore-fish)
- [DeepFish](https://alzayats.github.io/DeepFish/)
- [NOAA Labelled Fishes in the Wild](https://www.st.nmfs.noaa.gov/aiasi/DataSets.html)

## To Cite:

[paper](https://arxiv.org/abs/2305.02330)
```
@misc{yang2023biological,
      title={Biological Hotspot Mapping in Coral Reefs with Robotic Visual Surveys}, 
      author={Daniel Yang and Levi Cai and Stewart Jamieson and Yogesh Girdhar},
      year={2023},
      eprint={2305.02330},
      archivePrefix={arXiv},
      primaryClass={cs.RO}
}
```
## TODO:
- Train larger models
- requirements.txt for things like fathomnet environment
- COCO format output

## Download

```python
from huggingface_hub import hf_hub_download
import json

repo = "FathomNet/megafishdetector"
cfg = json.load(open(hf_hub_download(repo, "config.json")))
weights = hf_hub_download(repo, cfg["checkpoints"]["yolov5m_1280p"])
```