-
Notifications
You must be signed in to change notification settings - Fork 907
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
212e626
commit f895c01
Showing
4 changed files
with
158 additions
and
158 deletions.
There are no files selected for viewing
60 changes: 30 additions & 30 deletions
60
baselines/fedvssl/fedvssl/conf/mmcv_conf/finetuning/model_r3d18.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
"""Config file used for fine-tuning on UCF-101 dataset.""" | ||
|
||
model = dict( | ||
type="TSN", | ||
backbone=dict( | ||
type="R3D", | ||
depth=18, | ||
num_stages=4, | ||
stem=dict( | ||
temporal_kernel_size=3, | ||
temporal_stride=1, | ||
in_channels=3, | ||
with_pool=False, | ||
), | ||
down_sampling=[False, True, True, True], | ||
channel_multiplier=1.0, | ||
bottleneck_multiplier=1.0, | ||
with_bn=True, | ||
zero_init_residual=False, | ||
pretrained=None, | ||
), | ||
st_module=dict(spatial_type="avg", temporal_size=2, spatial_size=7), | ||
cls_head=dict( | ||
with_avg_pool=False, | ||
temporal_feature_size=1, | ||
spatial_feature_size=1, | ||
dropout_ratio=0.5, | ||
in_channels=512, | ||
init_std=0.001, | ||
num_classes=101, | ||
), | ||
) | ||
model = { | ||
"type": "TSN", | ||
"backbone": { | ||
"type": "R3D", | ||
"depth": 18, | ||
"num_stages": 4, | ||
"stem": { | ||
"temporal_kernel_size": 3, | ||
"temporal_stride": 1, | ||
"in_channels": 3, | ||
"with_pool": False, | ||
}, | ||
"down_sampling": [False, True, True, True], | ||
"channel_multiplier": 1.0, | ||
"bottleneck_multiplier": 1.0, | ||
"with_bn": True, | ||
"zero_init_residual": False, | ||
"pretrained": None, | ||
}, | ||
"st_module": {"spatial_type": "avg", "temporal_size": 2, "spatial_size": 7}, | ||
"cls_head": { | ||
"with_avg_pool": False, | ||
"temporal_feature_size": 1, | ||
"spatial_feature_size": 1, | ||
"dropout_ratio": 0.5, | ||
"in_channels": 512, | ||
"init_std": 0.001, | ||
"num_classes": 101, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
236 changes: 118 additions & 118 deletions
236
baselines/fedvssl/fedvssl/conf/mmcv_conf/finetuning/runtime_ucf101.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,137 +1,137 @@ | ||
"""Config file used for fine-tuning on UCF-101 dataset.""" | ||
|
||
dist_params = dict(backend="nccl") | ||
dist_params = {"backend": "nccl"} | ||
log_level = "INFO" | ||
load_from = None | ||
resume_from = None | ||
syncbn = True | ||
|
||
train_cfg = None | ||
test_cfg = None | ||
evaluation = dict(interval=10) | ||
evaluation = {"interval": 10} | ||
|
||
data = dict( | ||
videos_per_gpu=4, # total batch size 8*4 == 32 | ||
workers_per_gpu=4, | ||
train=dict( | ||
type="TSNDataset", | ||
name="ucf101_train_split1", | ||
data_source=dict( | ||
type="JsonClsDataSource", | ||
ann_file="ucf101/annotations/train_split_1.json", | ||
), | ||
backend=dict( | ||
type="ZipBackend", | ||
zip_fmt="ucf101/zips/{}.zip", | ||
frame_fmt="img_{:05d}.jpg", | ||
), | ||
frame_sampler=dict( | ||
type="RandomFrameSampler", | ||
num_clips=1, | ||
clip_len=16, | ||
strides=2, | ||
temporal_jitter=False, | ||
), | ||
test_mode=False, | ||
transform_cfg=[ | ||
dict(type="GroupScale", scales=[(149, 112), (171, 128), (192, 144)]), | ||
dict(type="GroupFlip", flip_prob=0.35), | ||
dict(type="RandomBrightness", prob=0.20, delta=32), | ||
dict(type="RandomContrast", prob=0.20, delta=0.20), | ||
dict( | ||
type="RandomHueSaturation", | ||
prob=0.20, | ||
hue_delta=12, | ||
saturation_delta=0.1, | ||
), | ||
dict(type="GroupRandomCrop", out_size=112), | ||
dict( | ||
type="GroupToTensor", | ||
switch_rgb_channels=True, | ||
div255=True, | ||
mean=(0.485, 0.456, 0.406), | ||
std=(0.229, 0.224, 0.225), | ||
), | ||
data = { | ||
"videos_per_gpu": 4, # total batch size 8*4 == 32 | ||
"workers_per_gpu": 4, | ||
"train": { | ||
"type": "TSNDataset", | ||
"name": "ucf101_train_split1", | ||
"data_source": { | ||
"type": "JsonClsDataSource", | ||
"ann_file": "ucf101/annotations/train_split_1.json", | ||
}, | ||
"backend": { | ||
"type": "ZipBackend", | ||
"zip_fmt": "ucf101/zips/{}.zip", | ||
"frame_fmt": "img_{:05d}.jpg", | ||
}, | ||
"frame_sampler": { | ||
"type": "RandomFrameSampler", | ||
"num_clips": 1, | ||
"clip_len": 16, | ||
"strides": 2, | ||
"temporal_jitter": False, | ||
}, | ||
"test_mode": False, | ||
"transform_cfg": [ | ||
{"type": "GroupScale", "scales": [(149, 112), (171, 128), (192, 144)]}, | ||
{"type": "GroupFlip", "flip_prob": 0.35}, | ||
{"type": "RandomBrightness", "prob": 0.20, "delta": 32}, | ||
{"type": "RandomContrast", "prob": 0.20, "delta": 0.20}, | ||
{ | ||
"type": "RandomHueSaturation", | ||
"prob": 0.20, | ||
"hue_delta": 12, | ||
"saturation_delta": 0.1, | ||
}, | ||
{"type": "GroupRandomCrop", "out_size": 112}, | ||
{ | ||
"type": "GroupToTensor", | ||
"switch_rgb_channels": True, | ||
"div255": True, | ||
"mean": (0.485, 0.456, 0.406), | ||
"std": (0.229, 0.224, 0.225), | ||
}, | ||
], | ||
), | ||
val=dict( | ||
type="TSNDataset", | ||
name="ucf101_test_split1", | ||
data_source=dict( | ||
type="JsonClsDataSource", | ||
ann_file="ucf101/annotations/test_split_1.json", | ||
), | ||
backend=dict( | ||
type="ZipBackend", | ||
zip_fmt="ucf101/zips/{}.zip", | ||
frame_fmt="img_{:05d}.jpg", | ||
), | ||
frame_sampler=dict( | ||
type="UniformFrameSampler", | ||
num_clips=10, | ||
clip_len=16, | ||
strides=2, | ||
temporal_jitter=False, | ||
), | ||
test_mode=True, | ||
transform_cfg=[ | ||
dict(type="GroupScale", scales=[(171, 128)]), | ||
dict(type="GroupCenterCrop", out_size=112), | ||
dict( | ||
type="GroupToTensor", | ||
switch_rgb_channels=True, | ||
div255=True, | ||
mean=(0.485, 0.456, 0.406), | ||
std=(0.229, 0.224, 0.225), | ||
), | ||
}, | ||
"val": { | ||
"type": "TSNDataset", | ||
"name": "ucf101_test_split1", | ||
"data_source": { | ||
"type": "JsonClsDataSource", | ||
"ann_file": "ucf101/annotations/test_split_1.json", | ||
}, | ||
"backend": { | ||
"type": "ZipBackend", | ||
"zip_fmt": "ucf101/zips/{}.zip", | ||
"frame_fmt": "img_{:05d}.jpg", | ||
}, | ||
"frame_sampler": { | ||
"type": "UniformFrameSampler", | ||
"num_clips": 10, | ||
"clip_len": 16, | ||
"strides": 2, | ||
"temporal_jitter": False, | ||
}, | ||
"test_mode": True, | ||
"transform_cfg": [ | ||
{"type": "GroupScale", "scales": [(171, 128)]}, | ||
{"type": "GroupCenterCrop", "out_size": 112}, | ||
{ | ||
"type": "GroupToTensor", | ||
"switch_rgb_channels": True, | ||
"div255": True, | ||
"mean": (0.485, 0.456, 0.406), | ||
"std": (0.229, 0.224, 0.225), | ||
}, | ||
], | ||
), | ||
test=dict( | ||
type="TSNDataset", | ||
name="ucf101_test_split1", | ||
data_source=dict( | ||
type="JsonClsDataSource", | ||
ann_file="ucf101/annotations/test_split_1.json", | ||
), | ||
backend=dict( | ||
type="ZipBackend", | ||
zip_fmt="ucf101/zips/{}.zip", | ||
frame_fmt="img_{:05d}.jpg", | ||
), | ||
frame_sampler=dict( | ||
type="UniformFrameSampler", | ||
num_clips=10, | ||
clip_len=16, | ||
strides=2, | ||
temporal_jitter=False, | ||
), | ||
test_mode=True, | ||
transform_cfg=[ | ||
dict(type="GroupScale", scales=[(171, 128)]), | ||
dict(type="GroupCenterCrop", out_size=112), | ||
dict( | ||
type="GroupToTensor", | ||
switch_rgb_channels=True, | ||
div255=True, | ||
mean=(0.485, 0.456, 0.406), | ||
std=(0.229, 0.224, 0.225), | ||
), | ||
}, | ||
"test": { | ||
"type": "TSNDataset", | ||
"name": "ucf101_test_split1", | ||
"data_source": { | ||
"type": "JsonClsDataSource", | ||
"ann_file": "ucf101/annotations/test_split_1.json", | ||
}, | ||
"backend": { | ||
"type": "ZipBackend", | ||
"zip_fmt": "ucf101/zips/{}.zip", | ||
"frame_fmt": "img_{:05d}.jpg", | ||
}, | ||
"frame_sampler": { | ||
"type": "UniformFrameSampler", | ||
"num_clips": 10, | ||
"clip_len": 16, | ||
"strides": 2, | ||
"temporal_jitter": False, | ||
}, | ||
"test_mode": True, | ||
"transform_cfg": [ | ||
{"type": "GroupScale", "scales": [(171, 128)]}, | ||
{"type": "GroupCenterCrop", "out_size": 112}, | ||
{ | ||
"type": "GroupToTensor", | ||
"switch_rgb_channels": True, | ||
"div255": True, | ||
"mean": (0.485, 0.456, 0.406), | ||
"std": (0.229, 0.224, 0.225), | ||
}, | ||
], | ||
), | ||
) | ||
}, | ||
} | ||
|
||
# optimizer | ||
total_epochs = 150 | ||
optimizer = dict(type="SGD", lr=0.01, momentum=0.9, weight_decay=5e-4) | ||
optimizer_config = dict(grad_clip=dict(max_norm=40, norm_type=2)) | ||
optimizer = {"type": "SGD", "lr": 0.01, "momentum": 0.9, "weight_decay": 5e-4} | ||
optimizer_config = {"grad_clip": {"max_norm": 40, "norm_type": 2}} | ||
# learning policy | ||
lr_config = dict(policy="step", step=[60, 120]) | ||
checkpoint_config = dict(interval=1, max_keep_ckpts=1, create_symlink=False) | ||
lr_config = {"policy": "step", "step": [60, 120]} | ||
checkpoint_config = {"interval": 1, "max_keep_ckpts": 1, "create_symlink": False} | ||
workflow = [("train", 50)] | ||
log_config = dict( | ||
interval=10, | ||
hooks=[ | ||
dict(type="TextLoggerHook"), | ||
dict(type="TensorboardLoggerHook"), | ||
log_config = { | ||
"interval": 10, | ||
"hooks": [ | ||
{"type": "TextLoggerHook"}, | ||
{"type": "TensorboardLoggerHook"}, | ||
], | ||
) | ||
} |