Skip to content

Commit fa80d5b

Browse files
authored
Merge pull request #152 from deruyter92/jaap/add_modelzoo_functionality
functionality for direct downloading and exporting the pytorch models from the modelzoo
2 parents d783a30 + cc90b4c commit fa80d5b

19 files changed

+1581
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ dlclive/check_install/dlc-live-tmp*
88
**DS_Store*
99
*vscode*
1010

11+
# Model zoo snapshots
12+
dlclive/modelzoo/snapshots/*
13+
1114
**/__MACOSX/
1215

1316
# Include tests directory (negate the *test* pattern for tests/)

dlclive/modelzoo/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from dlclive.modelzoo.utils import (
2+
_MODELZOO_PATH,
3+
list_available_models,
4+
list_available_projects,
5+
list_available_combinations,
6+
load_super_animal_config,
7+
download_super_animal_snapshot,
8+
)
9+
from dlclive.modelzoo.pytorch_model_zoo_export import export_modelzoo_model
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Project definitions (do not edit)
2+
Task:
3+
scorer:
4+
date:
5+
multianimalproject:
6+
identity:
7+
8+
# Project path (change when moving around)
9+
project_path:
10+
11+
# Annotation data set configuration (and individual video cropping parameters)
12+
video_sets:
13+
bodyparts:
14+
15+
# Fraction of video to start/stop when extracting frames for labeling/refinement
16+
start:
17+
stop:
18+
numframes2pick:
19+
20+
# Plotting configuration
21+
skeleton: []
22+
skeleton_color: black
23+
pcutoff:
24+
dotsize:
25+
alphavalue:
26+
colormap:
27+
28+
# Training,Evaluation and Analysis configuration
29+
TrainingFraction:
30+
iteration:
31+
default_net_type:
32+
default_augmenter:
33+
snapshotindex:
34+
batch_size: 1
35+
36+
# Cropping Parameters (for analysis and outlier frame detection)
37+
cropping:
38+
#if cropping is true for analysis, then set the values here:
39+
x1:
40+
x2:
41+
y1:
42+
y2:
43+
44+
# Refinement configuration (parameters from annotation dataset configuration also relevant in this stage)
45+
corner2move2:
46+
move2corner:
47+
alpha_r: 0.02
48+
apply_prob: 0.5
49+
clahe: true
50+
claheratio: 0.1
51+
crop_sampling: hybrid
52+
crop_size:
53+
- 400
54+
- 400
55+
cropratio: 0.4
56+
dataset:
57+
dataset_type: multi-animal-imgaug
58+
decay_steps: 30000
59+
display_iters: 500
60+
edge: false
61+
emboss:
62+
alpha:
63+
- 0.0
64+
- 1.0
65+
embossratio: 0.1
66+
strength:
67+
- 0.5
68+
- 1.5
69+
global_scale: 0.8
70+
histeq: true
71+
histeqratio: 0.1
72+
init_weights:
73+
intermediate_supervision: false
74+
intermediate_supervision_layer: 12
75+
location_refinement: true
76+
locref_huber_loss: true
77+
locref_loss_weight: 0.05
78+
locref_stdev: 7.2801
79+
lr_init: 0.0005
80+
max_input_size: 1500
81+
max_shift: 0.4
82+
mean_pixel:
83+
- 123.68
84+
- 116.779
85+
- 103.939
86+
metadataset:
87+
min_input_size: 64
88+
mirror: false
89+
multi_stage: true
90+
multi_step:
91+
- - 0.0001
92+
- 7500
93+
- - 5.0e-05
94+
- 12000
95+
- - 1.0e-05
96+
- 200000
97+
net_type: resnet_50
98+
num_idchannel: 0
99+
num_joints: 27
100+
num_limbs: 351
101+
optimizer: adam
102+
pafwidth: 20
103+
pairwise_huber_loss: false
104+
pairwise_loss_weight: 0.1
105+
pairwise_predict: false
106+
partaffinityfield_graph: []
107+
partaffinityfield_predict: false
108+
pos_dist_thresh: 17
109+
pre_resize: []
110+
rotation: 25
111+
rotratio: 0.4
112+
save_iters: 10000
113+
scale_jitter_lo: 0.5
114+
scale_jitter_up: 1.25
115+
sharpen: false
116+
sharpenratio: 0.3
117+
stride: 8.0
118+
weigh_only_present_joints: false
119+
gradient_masking: true
120+
weight_decay: 0.0001
121+
weigh_part_predictions: false
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
data:
2+
colormode: RGB
3+
inference:
4+
normalize_images: true
5+
train:
6+
affine:
7+
p: 0.5
8+
rotation: 30
9+
scaling: [ 1.0, 1.0 ]
10+
translation: 40
11+
collate:
12+
type: ResizeFromDataSizeCollate
13+
min_scale: 0.4
14+
max_scale: 1.0
15+
min_short_side: 128
16+
max_short_side: 1152
17+
multiple_of: 32
18+
to_square: false
19+
hflip: true
20+
normalize_images: true
21+
device: auto
22+
model:
23+
type: FasterRCNN
24+
variant: fasterrcnn_mobilenet_v3_large_fpn
25+
box_score_thresh: 0.6
26+
freeze_bn_stats: true
27+
freeze_bn_weights: false
28+
runner:
29+
type: DetectorTrainingRunner
30+
key_metric: "test.mAP@50:95"
31+
key_metric_asc: true
32+
eval_interval: 10
33+
optimizer:
34+
type: AdamW
35+
params:
36+
lr: 1e-5
37+
scheduler:
38+
type: LRListScheduler
39+
params:
40+
milestones: [ 90 ]
41+
lr_list: [ [ 1e-6 ] ]
42+
snapshots:
43+
max_snapshots: 5
44+
save_epochs: 25
45+
save_optimizer_state: false
46+
train_settings:
47+
batch_size: 1
48+
dataloader_workers: 0
49+
dataloader_pin_memory: false
50+
display_iters: 500
51+
epochs: 250
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
data:
2+
colormode: RGB
3+
inference:
4+
normalize_images: true
5+
train:
6+
affine:
7+
p: 0.5
8+
rotation: 30
9+
scaling: [ 1.0, 1.0 ]
10+
translation: 40
11+
collate:
12+
type: ResizeFromDataSizeCollate
13+
min_scale: 0.4
14+
max_scale: 1.0
15+
min_short_side: 128
16+
max_short_side: 1152
17+
multiple_of: 32
18+
to_square: false
19+
hflip: true
20+
normalize_images: true
21+
device: auto
22+
model:
23+
type: FasterRCNN
24+
variant: fasterrcnn_resnet50_fpn_v2
25+
box_score_thresh: 0.6
26+
freeze_bn_stats: true
27+
freeze_bn_weights: false
28+
runner:
29+
type: DetectorTrainingRunner
30+
key_metric: "test.mAP@50:95"
31+
key_metric_asc: true
32+
eval_interval: 10
33+
optimizer:
34+
type: AdamW
35+
params:
36+
lr: 1e-5
37+
scheduler:
38+
type: LRListScheduler
39+
params:
40+
milestones: [ 90 ]
41+
lr_list: [ [ 1e-6 ] ]
42+
snapshots:
43+
max_snapshots: 5
44+
save_epochs: 25
45+
save_optimizer_state: false
46+
train_settings:
47+
batch_size: 1
48+
dataloader_workers: 0
49+
dataloader_pin_memory: false
50+
display_iters: 500
51+
epochs: 250
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
data:
2+
colormode: RGB
3+
inference:
4+
auto_padding:
5+
pad_width_divisor: 32
6+
pad_height_divisor: 32
7+
normalize_images: true
8+
train:
9+
affine:
10+
p: 0.5
11+
scaling: [1.0, 1.0]
12+
rotation: 30
13+
translation: 0
14+
gaussian_noise: 12.75
15+
normalize_images: true
16+
auto_padding:
17+
pad_width_divisor: 32
18+
pad_height_divisor: 32
19+
device: auto
20+
method: td
21+
model:
22+
backbone:
23+
type: HRNet
24+
model_name: hrnet_w32
25+
pretrained: false
26+
freeze_bn_stats: True
27+
freeze_bn_weights: False
28+
interpolate_branches: false
29+
increased_channel_count: false
30+
backbone_output_channels: 32
31+
heads:
32+
bodypart:
33+
type: HeatmapHead
34+
weight_init: "normal"
35+
predictor:
36+
type: HeatmapPredictor
37+
apply_sigmoid: false
38+
clip_scores: true
39+
location_refinement: false
40+
locref_std: 7.2801
41+
target_generator:
42+
type: HeatmapGaussianGenerator
43+
num_heatmaps: "num_bodyparts"
44+
pos_dist_thresh: 17
45+
heatmap_mode: KEYPOINT
46+
generate_locref: false
47+
locref_std: 7.2801
48+
criterion:
49+
heatmap:
50+
type: WeightedMSECriterion
51+
weight: 1.0
52+
heatmap_config:
53+
channels: [32, "num_bodyparts"]
54+
kernel_size: [1]
55+
strides: [1]
56+
net_type: hrnet_w32
57+
runner:
58+
type: PoseTrainingRunner
59+
key_metric: "test.mAP"
60+
key_metric_asc: true
61+
eval_interval: 10
62+
optimizer:
63+
type: AdamW
64+
params:
65+
lr: 1e-5
66+
scheduler:
67+
type: LRListScheduler
68+
params:
69+
lr_list: [ [ 1e-6 ], [ 1e-7 ] ]
70+
milestones: [ 160, 190 ]
71+
snapshots:
72+
max_snapshots: 5
73+
save_epochs: 25
74+
save_optimizer_state: false
75+
train_settings:
76+
batch_size: 1
77+
dataloader_workers: 0
78+
dataloader_pin_memory: false
79+
display_iters: 500
80+
epochs: 200
81+
seed: 42

0 commit comments

Comments
 (0)