GaitGL_GREW supported
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
data_cfg:
|
||||
dataset_name: GREW
|
||||
dataset_root: your_path
|
||||
dataset_root: /home/data/grew-pkl-fixed
|
||||
dataset_partition: ./datasets/GREW/GREW.json
|
||||
num_workers: 16
|
||||
remove_no_gallery: false # Remove probe if no gallery for it
|
||||
@@ -92,7 +92,7 @@ trainer_cfg:
|
||||
batch_shuffle: true
|
||||
batch_size:
|
||||
- 32 # TripletSampler, batch_size[0] indicates Number of Identity
|
||||
- 4 # batch_size[1] indicates Samples sequqnce for each Identity
|
||||
- 8 # batch_size[1] indicates Samples sequqnce for each Identity
|
||||
frames_num_fixed: 30 # fixed frames number for training
|
||||
frames_num_max: 50 # max frames number for unfixed training
|
||||
frames_num_min: 25 # min frames number for unfixed traing
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
# Note : *** the batch_size should be equal to the gpus number at the test phase!!! ***
|
||||
data_cfg:
|
||||
dataset_name: GREW
|
||||
dataset_root: your_path
|
||||
dataset_partition: ./datasets/GREW/GREW.json
|
||||
num_workers: 16
|
||||
remove_no_gallery: false # Remove probe if no gallery for it
|
||||
test_dataset_name: GREW
|
||||
|
||||
evaluator_cfg:
|
||||
enable_distributed: true
|
||||
enable_float16: false
|
||||
restore_ckpt_strict: true
|
||||
restore_hint: 250000
|
||||
save_name: GaitGL
|
||||
eval_func: identification_GREW_submission # identification_real_scene # identification_GREW_submission
|
||||
sampler:
|
||||
batch_size: 4
|
||||
sample_type: all_ordered
|
||||
type: InferenceSampler
|
||||
|
||||
loss_cfg:
|
||||
- loss_term_weight: 1.0
|
||||
margin: 0.2
|
||||
type: TripletLoss
|
||||
log_prefix: triplet
|
||||
- loss_term_weight: 1.0
|
||||
scale: 1
|
||||
type: CrossEntropyLoss
|
||||
log_accuracy: true
|
||||
label_smooth: true
|
||||
log_prefix: softmax
|
||||
|
||||
model_cfg:
|
||||
model: GaitGL
|
||||
channels: [32, 64, 128, 256]
|
||||
class_num: 20000
|
||||
|
||||
optimizer_cfg:
|
||||
lr: 1.0e-4
|
||||
solver: Adam
|
||||
weight_decay: 0
|
||||
|
||||
scheduler_cfg:
|
||||
gamma: 0.1
|
||||
milestones:
|
||||
- 150000
|
||||
- 200000
|
||||
scheduler: MultiStepLR
|
||||
|
||||
trainer_cfg:
|
||||
enable_distributed: true
|
||||
enable_float16: true
|
||||
with_test: false
|
||||
log_iter: 100
|
||||
restore_ckpt_strict: true
|
||||
restore_hint: 0
|
||||
save_iter: 10000
|
||||
save_name: GaitGL
|
||||
sync_BN: true
|
||||
total_iter: 250000
|
||||
sampler:
|
||||
batch_shuffle: true
|
||||
batch_size:
|
||||
- 32
|
||||
- 4
|
||||
frames_num_fixed: 30
|
||||
frames_skip_num: 0
|
||||
sample_type: fixed_ordered
|
||||
type: TripletSampler
|
||||
@@ -0,0 +1,74 @@
|
||||
# Note : *** the batch_size should be equal to the gpus number at the test phase!!! ***
|
||||
data_cfg:
|
||||
dataset_name: GREW
|
||||
dataset_root: your_path
|
||||
dataset_partition: ./datasets/GREW/GREW.json
|
||||
num_workers: 16
|
||||
remove_no_gallery: false # Remove probe if no gallery for it
|
||||
test_dataset_name: GREW
|
||||
|
||||
evaluator_cfg:
|
||||
enable_distributed: true
|
||||
enable_float16: false
|
||||
restore_ckpt_strict: true
|
||||
restore_hint: 250000
|
||||
save_name: GaitGL_BNNeck
|
||||
eval_func: identification_GREW_submission # identification_real_scene # identification_GREW_submission
|
||||
sampler:
|
||||
batch_size: 4
|
||||
sample_type: all_ordered
|
||||
type: InferenceSampler
|
||||
|
||||
loss_cfg:
|
||||
- loss_term_weight: 1.0
|
||||
margin: 0.2
|
||||
type: TripletLoss
|
||||
log_prefix: triplet
|
||||
- loss_term_weight: 1.0
|
||||
scale: 1
|
||||
type: CrossEntropyLoss
|
||||
log_accuracy: true
|
||||
label_smooth: true
|
||||
log_prefix: softmax
|
||||
|
||||
model_cfg:
|
||||
model: GaitGL
|
||||
channels: [32, 64, 128, 256]
|
||||
class_num: 20000
|
||||
SeparateBNNecks:
|
||||
class_num: 20000
|
||||
in_channels: 256
|
||||
parts_num: 64
|
||||
|
||||
optimizer_cfg:
|
||||
lr: 1.0e-4
|
||||
solver: Adam
|
||||
weight_decay: 0
|
||||
|
||||
scheduler_cfg:
|
||||
gamma: 0.1
|
||||
milestones:
|
||||
- 150000
|
||||
- 200000
|
||||
scheduler: MultiStepLR
|
||||
|
||||
trainer_cfg:
|
||||
enable_distributed: true
|
||||
enable_float16: true
|
||||
with_test: false
|
||||
log_iter: 100
|
||||
restore_ckpt_strict: true
|
||||
restore_hint: 0
|
||||
save_iter: 10000
|
||||
save_name: GaitGL_BNNeck
|
||||
sync_BN: true
|
||||
total_iter: 250000
|
||||
sampler:
|
||||
batch_shuffle: true
|
||||
batch_size:
|
||||
- 32
|
||||
- 4
|
||||
frames_num_fixed: 30
|
||||
frames_skip_num: 0
|
||||
sample_type: fixed_ordered
|
||||
type: TripletSampler
|
||||
@@ -125,5 +125,9 @@ if __name__ == "__main__":
|
||||
for url in urls:
|
||||
download_file_and_uncompress(
|
||||
url=url, extrapath='output')
|
||||
|
||||
gaitgl_grew = ['https://github.com/ShiqiYu/OpenGait/releases/download/v1.1/pretrained_grew_gaitgl.zip',
|
||||
'https://github.com/ShiqiYu/OpenGait/releases/download/v1.1/pretrained_grew_gaitgl_bnneck.zip']
|
||||
for gaitgl in gaitgl_grew:
|
||||
download_file_and_uncompress(
|
||||
url=gaitgl, extrapath='output/GREW/GaitGL')
|
||||
print("Pretrained model download success!")
|
||||
|
||||
@@ -3,7 +3,7 @@ import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
|
||||
from ..base_model import BaseModel
|
||||
from ..modules import SeparateFCs, BasicConv3d, PackSequenceWrapper
|
||||
from ..modules import SeparateFCs, BasicConv3d, PackSequenceWrapper, SeparateBNNecks
|
||||
|
||||
|
||||
class GLConv(nn.Module):
|
||||
@@ -75,8 +75,8 @@ class GaitGL(BaseModel):
|
||||
class_num = model_cfg['class_num']
|
||||
dataset_name = self.cfgs['data_cfg']['dataset_name']
|
||||
|
||||
if dataset_name == 'OUMVLP':
|
||||
# For OUMVLP
|
||||
if dataset_name in ['OUMVLP','GREW']:
|
||||
# For OUMVLP and GREW
|
||||
self.conv3d = nn.Sequential(
|
||||
BasicConv3d(1, in_c[0], kernel_size=(3, 3, 3),
|
||||
stride=(1, 1, 1), padding=(1, 1, 1)),
|
||||
@@ -135,13 +135,20 @@ class GaitGL(BaseModel):
|
||||
self.GLConvB2 = GLConv(in_c[2], in_c[2], halving=3, fm_sign=True, kernel_size=(
|
||||
3, 3, 3), stride=(1, 1, 1), padding=(1, 1, 1))
|
||||
|
||||
self.Head0 = SeparateFCs(64, in_c[-1], in_c[-1])
|
||||
self.Bn = nn.BatchNorm1d(in_c[-1])
|
||||
self.Head1 = SeparateFCs(64, in_c[-1], class_num)
|
||||
|
||||
self.TP = PackSequenceWrapper(torch.max)
|
||||
self.HPP = GeMHPP()
|
||||
|
||||
self.Head0 = SeparateFCs(64, in_c[-1], in_c[-1])
|
||||
|
||||
if 'SeparateBNNecks' in model_cfg.keys():
|
||||
self.BNNecks = SeparateBNNecks(**model_cfg['SeparateBNNecks'])
|
||||
self.Bn_head = False
|
||||
else:
|
||||
self.Bn = nn.BatchNorm1d(in_c[-1])
|
||||
self.Head1 = SeparateFCs(64, in_c[-1], class_num)
|
||||
self.Bn_head = True
|
||||
|
||||
def forward(self, inputs):
|
||||
ipts, labs, _, _, seqL = inputs
|
||||
seqL = None if not self.training else seqL
|
||||
@@ -169,12 +176,16 @@ class GaitGL(BaseModel):
|
||||
outs = outs.permute(2, 0, 1).contiguous() # [p, n, c]
|
||||
|
||||
gait = self.Head0(outs) # [p, n, c]
|
||||
|
||||
if self.Bn_head: # Original GaitGL Head
|
||||
gait = gait.permute(1, 2, 0).contiguous() # [n, c, p]
|
||||
bnft = self.Bn(gait) # [n, c, p]
|
||||
logi = self.Head1(bnft.permute(2, 0, 1).contiguous()) # [p, n, c]
|
||||
|
||||
gait = gait.permute(0, 2, 1).contiguous() # [n, p, c]
|
||||
bnft = bnft.permute(0, 2, 1).contiguous() # [n, p, c]
|
||||
else: # BNNechk as Head
|
||||
bnft, logi = self.BNNecks(gait) # [p, n, c]
|
||||
bnft = bnft.permute(1, 0, 2).contiguous() # [n, p, c]
|
||||
|
||||
logi = logi.permute(1, 0, 2).contiguous() # [n, p, c]
|
||||
|
||||
n, _, s, h, w = sils.size()
|
||||
|
||||
Reference in New Issue
Block a user