Skip to content

Commit 5b8e15a

Browse files
authored
Merge pull request #19 from marco-willi/add_models
add pre-trained models for download
2 parents 8a7eb87 + a080a0c commit 5b8e15a

8 files changed

+173
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This repository contains code and documentation to train and apply convolutional
1919
3. Multi-output modelling: model species, behaviors, and any other label at the same time.
2020
4. A large variety of options: models, data augmentation, installation, data-prep, transfer-learning, and more.
2121
5. Tested approach: This code is currently in use and is being developed further.
22+
6. Trained models for download: [Trained Models](docs/trained_models.md)
2223

2324
## Pre-Requisites
2425

@@ -340,6 +341,10 @@ This will apply the following transformations to each image during model trainin
340341

341342
This feature is experimental in the sense that it has not yet been thoroughly tested. We think that this option may benefit models which have to identify the presence of animals -- especially if there are small animals that are difficult to see without the motion information.
342343

344+
## Downloading Trained Models
345+
346+
See the following documentation about trained models available for download: [Trained Models](docs/trained_models.md)
347+
343348

344349
## Testing the Code
345350

108 KB
Binary file not shown.
211 KB
Binary file not shown.
112 KB
Binary file not shown.
109 KB
Binary file not shown.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"SER_S11#B04#1#62":
2+
{"predictions_top":
3+
{"standing": "0",
4+
"interacting": "0",
5+
"young_present": "0",
6+
"moving": "1",
7+
"eating": "0",
8+
"count": "1",
9+
"species": "zebra",
10+
"resting": "0"},
11+
"aggregated_pred":
12+
{"count":
13+
{"7": "0.0000", "2": "0.0317", "10": "0.0000", "4": "0.0005",
14+
"1": "0.9650", "5": "0.0001", "3": "0.0026", "11-50": "0.0000",
15+
"8": "0.0000", "51+": "0.0000", "6": "0.0000", "9": "0.0000"},
16+
"interacting": {"0": "0.9999", "1": "0.0001"},
17+
"young_present": {"0": "0.9993", "1": "0.0007"},
18+
"moving": {"0": "0.1518", "1": "0.8482"},
19+
"eating": {"0": "0.9830", "1": "0.0170"},
20+
"standing": {"0": "0.8392", "1": "0.1608"},
21+
"species": {
22+
"baboon": "0.0000", "civet": "0.0000", "buffalo":"0.0000",
23+
"kudu": "0.0000", "rodents": "0.0000", "waterbuck": "0.0000",
24+
"vulture": "0.0000", "impala": "0.0000", "human": "0.0000",
25+
"lion": "0.0000", "genet": "0.0000", "mongoose": "0.0000",
26+
"caracal": "0.0000", "rhinoceros": "0.0000", "klipspringer": "0.0000",
27+
"topi": "0.0000", "secretarybird": "0.0000", "sitatunga": "0.0000",
28+
"springbok": "0.0000", "duiker": "0.0000", "hartebeest": "0.0000",
29+
"ottercapeclawless": "0.0000", "hyenabrown": "0.0000",
30+
"bushpig": "0.0000", "domesticanimal": "0.0000", "pangolin": "0.0000",
31+
"bontebok": "0.0000", "gemsbokoryx": "0.0000", "wilddog": "0.0000",
32+
"rabbitriverine": "0.0000", "serval": "0.0000", "fallowdeer": "0.0000",
33+
"wildcat": "0.0000", "groundsquirrel": "0.0000", "hippopotamus": "0.0000",
34+
"warthog": "0.0000", "reedbuck": "0.0000", "meerkatsuricate": "0.0000",
35+
"dikdik": "0.0000", "craneblue": "0.0000", "reptiles": "0.0000",
36+
"birdother": "0.0000", "zebra": "0.9999", "cattle": "0.0000",
37+
"foxbateared": "0.0000", "bushbaby": "0.0000", "steenbok": "0.0000",
38+
"tsessebe": "0.0000", "grysbok": "0.0000", "rhebokgrey": "0.0000",
39+
"wildebeest": "0.0000", "hyenastriped": "0.0000", "bat": "0.0000",
40+
"ostrich": "0.0000", "tortoise": "0.0000", "aardwolf": "0.0000",
41+
"eland": "0.0000", "rabbitredrock": "0.0000", "honeybadger": "0.0000",
42+
"roan": "0.0000", "giraffe": "0.0000", "hare": "0.0000",
43+
"foxcape":"0.0000", "nyala": "0.0000", "blesbok": "0.0000",
44+
"monkeysamango": "0.0000", "insectspider": "0.0000",
45+
"sable": "0.0000", "jackal": "0.0000", "gazellethomsons": "0.0000",
46+
"zorilla": "0.0000", "bustardludwigs": "0.0000",
47+
"gazellegrants": "0.0000", "monkeyvervet": "0.0000",
48+
"aardvark": "0.0000", "hyenaspotted": "0.0000", "bushbuck": "0.0000",
49+
"suni": "0.0000", "bustardkori": "0.0000", "porcupine": "0.0000",
50+
"cheetah": "0.0000", "leopard": "0.0000", "fire": "0.0000",
51+
"elephant": "0.0000", "guineafowl":"0.0000"},
52+
"resting": {"0": "0.9995", "1": "0.0005"}},
53+
"confidences_top": {
54+
"standing": "0.8392",
55+
"interacting": "0.9999",
56+
"young_present": "0.9993",
57+
"moving": "0.8482",
58+
"eating": "0.9830",
59+
"count": "0.9650",
60+
"species": "0.9999",
61+
"resting": "0.9995"}}

docs/figures/zebra_example.png

695 KB
Loading

docs/trained_models.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Trained Models
2+
3+
The following trained models are available for downloading. The models were trained on AWS using a p3.2xlarge EC2 instance and Docker as described here [AWS example](../docs/Docker_GPU.md). The models can be apply as described here [Model Application](../README.md#5-model-use).
4+
5+
## Empty or Not Model
6+
7+
Download from: https://s3.msi.umn.edu/snapshotsafari/models/empty_or_not/ResNet18_448_v1.zip
8+
9+
* Number of capture events in training set: 3.66 million
10+
* Architecture: ResNet18
11+
* Input Resolution: 448x448
12+
* Images: mainly from Tanzania (Serengeti National Park) and South Africa
13+
* Output: is_blank - binary label indicating whether the capture is empty ('blank'), i.e. no animal or human
14+
15+
16+
### Training Parameters
17+
18+
The model was trained using the following command:
19+
20+
```
21+
sudo docker exec ctc ctc.train \
22+
-train_tfr_path $TFR_FILES \
23+
-val_tfr_path $TFR_FILES \
24+
-test_tfr_path $TFR_FILES \
25+
-class_mapping_json $LABEL_MAPPINGS \
26+
-run_outputs_dir $RUN_OUTPUT \
27+
-model_save_dir $MODEL_SAVE \
28+
-model ResNet18 \
29+
-labels is_blank \
30+
-batch_size 64 \
31+
-n_cpus 8 \
32+
-n_gpus 1 \
33+
-buffer_size 512 \
34+
-max_epochs 70 \
35+
-reduce_lr_on_plateau_patience 4 \
36+
-early_stopping_patience 6 \
37+
-output_width 448 \
38+
-output_height 448 \
39+
-n_batches_per_epoch_train 5000 \
40+
-rotate_by_angle 0 \
41+
-zoom_factor 0
42+
```
43+
44+
## Species Model
45+
46+
Download from: https://s3.msi.umn.edu/snapshotsafari/models/species/Xception_v1.zip
47+
48+
* Number of captures in training set: 1.84 million
49+
* Architecture: Xception
50+
* Input Resolution: 299x299
51+
* Images: mainly from Tanzania (Serengeti National Part) and South Africa
52+
* Output: species, counts, standing, resting, moving, eating, interacting, young_present
53+
* Number of species: 85
54+
55+
<img src="https://github.com/marco-willi/camera-trap-classifier/blob/master/docs/figures/zebra_example.png"/>
56+
57+
*This figure shows a capture of a Zebra (see corresponding model output below).*
58+
59+
Example Model Output for the image above: [Xception_v1 Output](../docs/figures/example_pred_Xception_v1.json). This file also shows the complete list of species and all the other labels that the model was trained to classify.
60+
61+
### Training Parameters
62+
63+
The model was trained using the following command:
64+
65+
```
66+
sudo docker exec ctc ctc.train \
67+
-train_tfr_path $TFR_FILES \
68+
-val_tfr_path $TFR_FILES \
69+
-test_tfr_path $TFR_FILES \
70+
-class_mapping_json $LABEL_MAPPINGS \
71+
-run_outputs_dir $RUN_OUTPUT \
72+
-model_save_dir $MODEL_SAVE \
73+
-model Xception \
74+
-labels species count standing resting moving eating interacting young_present \
75+
-batch_size 32 \
76+
-n_cpus 8 \
77+
-n_gpus 1 \
78+
-buffer_size 512 \
79+
-max_epochs 70 \
80+
-reduce_lr_on_plateau_patience 6 \
81+
-early_stopping_patience 10 \
82+
-rotate_by_angle 0 \
83+
-zoom_factor 0 \
84+
-n_batches_per_epoch_train 10000 \
85+
-max_epochs 70
86+
```
87+
88+
## Evaluation Results
89+
90+
### Results on Test-Data (in sample data)
91+
92+
The following report shows evaluation results on the test data: [Evaluation Results](../docs/figures/Evaluation_SnapshotSafariModels.pdf).
93+
94+
Shown are results separated by different locations / parks. The overwhelming majority of the images is from 'SER' the Serengeti national park.
95+
96+
The data is refered to as 'in sample data' because it is based on data from the same locations as used in training the model. This may introduce a positive bias to the results. Furthermore, the species model is evaluated on species images only (i.e. the model could not make the error of predicting a species when there is none).
97+
98+
99+
### Results on Independent Data (out of sample data)
100+
101+
The following reports show model evaluations using independent test data:
102+
103+
* Grumeti: [Evaluation Results Grumeti](../docs/figures/GRU_S1_model_evaluation.pdf)
104+
* Enonkishu: [Evaluation Results Enonkishu](../docs/figures/ENO_S1_model_evaluation.pdf)
105+
* Kruger: [Evaluation Results Kruger](../docs/figures/KRU_S1_model_evaluation.pdf)
106+
107+
The evaluation from these locations is based on a realistic scenario, on data collected from locations (Enonkishu and Kruger) the model has not seen or mostly not seen (Grumeti), as well as by applying a two-stage process: 1) identify images with animals and 2) identify species on images considered as containing an animal. Note that some (rare) species from Kruger / Enonkishu are completely unknown to the model and thus not predictable.

0 commit comments

Comments
 (0)