File size: 7,271 Bytes
80338ba
 
ed322e0
 
 
 
 
 
 
80338ba
1b6cc44
ee55ee4
bf4f981
1b6cc44
fe74c87
ef2d930
c619ee3
 
 
 
fc12638
1b6cc44
aab656e
 
ef2d930
1b6cc44
37e14d5
 
 
 
6b29db0
79242de
f8819ba
 
 
 
 
1a99aed
37e14d5
 
f8819ba
 
 
 
 
1a99aed
aab656e
 
ef2d930
6b29db0
0ddd7e8
8a373e7
55fbeae
8a373e7
8d06b9c
8a373e7
8d06b9c
 
8a373e7
 
 
 
 
 
0ddd7e8
 
 
 
 
aab656e
ef2d930
6b29db0
e06d1f0
6b29db0
e06d1f0
 
f0a017e
fa1c436
6b29db0
ee4d1af
 
f0a017e
13c8e12
6b29db0
a3ab0f2
1b6cc44
aab656e
ef2d930
fc12638
fa1c436
e5dcc60
be1b166
fc12638
be1b166
f8819ba
ed322e0
 
ef2d930
67b40ea
 
 
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
---
license: mit
language:
- en
base_model:
- Ultralytics/YOLO11
pipeline_tag: object-detection
tags:
- otters
---

# Behavioral Tracking Model for Captive Animals
**By Sophia Mangrubang**

---
# Scientific Context
Behavioral observation and data collection is an integral part of maintaining animals in captivity. Large corporations, such as zoos, rely on staff members to observe animal behaviors as a means of assessing their health. However, without constant surveillance, key behavioral patterns can be overlooked. Machine learning provides a unique opportunity to reduce the time-commitment of staff, increase monitoring time, and produce visualizations that provide valuable insights. 

Currently, there are a few major products that utilize machine learning methods for behavioral observation in captivity. These models are insightful, but lack the accessibility and customization of an open source model. 

My dataset, consisting of Southern Sea Otter enclosure live feeds, will serve as an example of how scientists could use my model to gain behavioral information. From the model outputs, users can track, count, and study long term species patterns across multiple enclosures. These results can then aid in making care-related decisions.


---
# Dataset Description

My dataset consists of 3 live feed videos of Southern Sea Otter enclosures. One video is from the Georgia Aquarium, and two are from the Monterey Bay Aquarium. The dataset consists of 348 raw images, and around 900 after the augmentations were added. Within all 3 videos, Southern Sea Otters are the only class present and there are 3 - 5 in each enclosure. 

Within each enclosure, my 3 defined zones of interest are present. These zones are water, land, and seclusion. The enclosures are divided in this way to produce the most detailed tracking information possible for the model outputs.

### Metadata:
Video 1:
- **Source:** Georgia Aquarium
- **Location:** Atlanta, Georgia
- **Time:** Current, 24/7
- **Collection Method:** Live Video Feed
- **Classes:** Southern Sea Otter
- **Citation:** Sea otter webcam: Live from Georgia Aquarium: Visit Today. Georgia Aquarium. (2025, January 13). https://www.georgiaaquarium.org/webcam/southern-sea-otter-webcam/

Videos 2 & 3:
- **Source:** Monterey Bay Aquarium
- **Location:** Monterey, California
- **Time:** Current, 24/7
- **Collection Method:** Live Video Feed
- **Classes:** Southern Sea Otter
- **Citation:** Sea Otter Cam. Montereybayaquarium.org. (2025). https://www.montereybayaquarium.org/animals/live-cams/sea-otter-cam

---
# Model Selection
### YOLOv11 Object Detection Model
I chose to use YOLOv11 to create a custom object detection model. The model was trained to detect the presence of Southern Sea Otters in water and on land. I chose an object detection model because it would allow me to add additional features to my model through supplementary code snippets. The features would produce additional visualizations to better interpret movement patterns and behaviors from the dataset. I manipulated the code [found in our textbook](https://oceancv.org/) to better identify and correctly label the otters in lower resolution cam footage, as well as in both land and water. These are my model parameters. 
```python
# Train the model
results = model.train(
    data=dataset_config, 
    epochs=100,
    batch=64,  
    imgsz=640,
    plots=True,
    patience=50,
    conf=0.55,
    iou=0.5
)
```
### Additional Features: Ultralytics Objects Counting in Regions & Heatmap
Additionally, I utilized code from Ultralytics to produce an object counting in region video. I defined the 3 regions of interest (land, water, seclusion) through pixel coordinates over the input video, meaning the model was then able to differentiate between each zone and produce unique counts for each. I was able to manipulate the base code to track all 3 regions at once. 

I also utilized Ultralytics’ heatmap code to display a heatmap on the input video, showing which regions of the enclosure were most frequently occupied. I specifically focused the heatmap on the land zone, where the otters were spending most of their resting time. I manipulated the code to focus on the land zone, using pixel locations to create a custom region within the video.

---
# Model Assessment
### Here are the metrics I used to assess the accuracy and performance of my model during training.  

### Confusion Matrix
The final confusion matrix shows that my model was very successful at identifying sea otters across the dataset. There are a portion of mislabels where the model mistook a sea otter for background, but this can be expected with the quality of training images and smaller dataset.  
https://huggingface.co/OceanCV/Southern_Sea_Otter_Tracking/blob/main/confusion_matrix_final.png
![Confusion matrix from final run](https://huggingface.co/OceanCV/Southern_Sea_Otter_Tracking/resolve/main/confusion_matrix_final.png?download=true)

### F1 Score
The final F1 curve shows my model’s high precision and recall across the various confidence levels. The curve had a high peak, signifying a harmonic balance between precision and recall. 
https://huggingface.co/OceanCV/Southern_Sea_Otter_Tracking/blob/main/F1_curve.png
![F1 graph from final run](https://huggingface.co/OceanCV/Southern_Sea_Otter_Tracking/resolve/main/F1_curve.png?download=true)

### Object Detection Model Output
My final object detection output video was a key metric in assessing the performance of my model. I bounced between looking at the output video, assessing how accurate the bounding boxes and identifications were, and rerunning the model with modified parameters. My final model output was successful at identifying sea otters in both land and water, with minimal misclassifications or missed detections. The final video can be found in my respository or downloaded [here](https://huggingface.co/OceanCV/Southern_Sea_Otter_Tracking/resolve/main/object_detection_final.avi?download=true).

---
# Model Use-case
**Example Proposal:** Utilize the Behavioral Tracking Model to track and analyze the movement patterns of sea otters between water, land, and secluded zones to assess their interactions with their enclosure.

**Example Hypothesis:** Southern Sea Otters will congregate in the water zone most frequently and for the most time, and will rarely enter the seclusion zone.

**Example Impact:** Researchers found that sea otters spend the majority of their resting time on land, hidden behind objects (rocks, toy structures, etc.) and in the seclusion zone. They then modified the enclosure to provide more private spaces, such as large toys and structures, to create more secluded spaces. 

**Model Justification:** My model would be a reasonable tool for initial data collection, providing species interaction data across zones, animal frequency, and areas of interest within the enclosure.

---
# Disclaimer
Credit for all videos used in the dataset go to the [Monterey Bay Aquarium](https://www.montereybayaquarium.org/) and [Georgia Aquarium](https://www.georgiaaquarium.org/).
- **Video 1:** [Link to Youtube video used](https://www.youtube.com/watch?v=bfjxsHrgeQs)
- **Video 2 & 3:** [Link to Youtube video used](https://www.youtube.com/watch?v=9JlkEzxk6Qc)