提交 26594a1f 编写于 作者: S SunGaofeng

remove reader and metrics from nextvlad stnet tsn

上级 1047f81c
......@@ -58,7 +58,6 @@ class NEXTVLAD(ModelBase):
# other params
self.batch_size = self.get_config_from_sec(self.mode, 'batch_size')
self.list = self.get_config_from_sec(self.mode, 'filelist')
def build_input(self, use_pyreader=True):
rgb_shape = [self.video_feature_size]
......@@ -148,23 +147,6 @@ class NEXTVLAD(ModelBase):
self.label_input
]
def create_dataset_args(self):
dataset_args = {}
dataset_args['num_classes'] = self.num_classes
if self.use_gpu and self.py_reader:
dataset_args['batch_size'] = int(self.batch_size / self.num_gpus)
else:
dataset_args['batch_size'] = self.batch_size
dataset_args['list'] = self.list
dataset_args['eigen_file'] = self.eigen_file
return dataset_args
def create_metrics_args(self):
metrics_args = {}
metrics_args['num_classes'] = self.num_classes
metrics_args['topk'] = 20
return metrics_args
def get_learning_rate_decay_list(base_learning_rate, decay, max_iter,
decay_examples, total_batch_size):
......
......@@ -26,7 +26,6 @@ class STNET(ModelBase):
self.get_config()
def get_config(self):
self.format = self.get_config_from_sec('model', 'format')
self.num_classes = self.get_config_from_sec('model', 'num_classes')
self.seg_num = self.get_config_from_sec('model', 'seg_num')
self.seglen = self.get_config_from_sec('model', 'seglen')
......@@ -43,16 +42,9 @@ class STNET(ModelBase):
self.l2_weight_decay = self.get_config_from_sec('train',
'l2_weight_decay')
self.momentum = self.get_config_from_sec('train', 'momentum')
self.use_gpu = self.get_config_from_sec('train', 'use_gpu')
self.num_gpus = self.get_config_from_sec('train', 'num_gpus')
self.short_size = self.get_config_from_sec(self.mode, 'short_size')
self.target_size = self.get_config_from_sec(self.mode, 'target_size')
self.num_reader_threads = self.get_config_from_sec(self.mode,
'num_reader_threads')
self.buf_size = self.get_config_from_sec(self.mode, 'buf_size')
self.batch_size = self.get_config_from_sec(self.mode, 'batch_size')
self.filelist = self.get_config_from_sec(self.mode, 'filelist')
def build_input(self, use_pyreader=True):
image_shape = [3, self.target_size, self.target_size]
......@@ -130,29 +122,6 @@ class STNET(ModelBase):
self.label_input
]
def create_dataset_args(self):
cfg = {}
cfg['format'] = self.format
cfg['num_classes'] = self.num_classes
cfg['seg_num'] = self.seg_num
cfg['seglen'] = self.seglen
cfg['short_size'] = self.short_size
cfg['target_size'] = self.target_size
cfg['num_reader_threads'] = self.num_reader_threads
cfg['buf_size'] = self.buf_size
cfg['image_mean'] = self.image_mean
cfg['image_std'] = self.image_std
cfg['list'] = self.filelist
if (self.use_gpu) and (self.py_reader is not None):
cfg['batch_size'] = int(self.batch_size / self.num_gpus)
else:
cfg['batch_size'] = self.batch_size
return cfg
def create_metrics_args(self):
return {}
def load_pretrain_params(self, exe, pretrain, prog):
def is_parameter(var):
if isinstance(var, fluid.framework.Parameter):
......
......@@ -27,7 +27,6 @@ class TSN(ModelBase):
self.get_config()
def get_config(self):
self.format = self.get_config_from_sec('model', 'format')
self.num_classes = self.get_config_from_sec('model', 'num_classes')
self.seg_num = self.get_config_from_sec('model', 'seg_num')
self.seglen = self.get_config_from_sec('model', 'seglen')
......@@ -44,16 +43,9 @@ class TSN(ModelBase):
self.l2_weight_decay = self.get_config_from_sec('train',
'l2_weight_decay')
self.momentum = self.get_config_from_sec('train', 'momentum')
self.use_gpu = self.get_config_from_sec('train', 'use_gpu')
self.num_gpus = self.get_config_from_sec('train', 'num_gpus')
self.short_size = self.get_config_from_sec(self.mode, 'short_size')
self.target_size = self.get_config_from_sec(self.mode, 'target_size')
self.num_reader_threads = self.get_config_from_sec(self.mode,
'num_reader_threads')
self.buf_size = self.get_config_from_sec(self.mode, 'buf_size')
self.batch_size = self.get_config_from_sec(self.mode, 'batch_size')
self.filelist = self.get_config_from_sec(self.mode, 'filelist')
def build_input(self, use_pyreader=True):
image_shape = [3, self.target_size, self.target_size]
......@@ -133,26 +125,3 @@ class TSN(ModelBase):
return self.feature_input if self.mode == 'infer' else self.feature_input + [
self.label_input
]
def create_dataset_args(self):
cfg = {}
cfg['format'] = self.format
cfg['num_classes'] = self.num_classes
cfg['seg_num'] = self.seg_num
cfg['seglen'] = self.seglen
cfg['short_size'] = self.short_size
cfg['target_size'] = self.target_size
cfg['num_reader_threads'] = self.num_reader_threads
cfg['buf_size'] = self.buf_size
cfg['image_mean'] = self.image_mean
cfg['image_std'] = self.image_std
cfg['list'] = self.filelist
if self.use_gpu and (self.py_reader is not None):
cfg['batch_size'] = int(self.batch_size / self.num_gpus)
else:
cfg['batch_size'] = self.batch_size
return cfg
def create_metrics_args(self):
return {}
python infer.py --model-name="NEXTVLAD" --config=./configs/nextvlad.txt --filelist=./data/youtube8m/infer.list \
python3 infer.py --model-name="NEXTVLAD" --config=./configs/nextvlad.txt --filelist=./data/youtube8m/infer.list \
--weights=./checkpoints/NEXTVLAD_epoch0 \
--save-dir="./save"
python infer.py --model-name="STNET" --config=./configs/stnet.txt --filelist=./data/kinetics/infer.list \
python3 infer.py --model-name="STNET" --config=./configs/stnet.txt --filelist=./data/kinetics/infer.list \
--log-interval=10 --weights=./checkpoints/STNET_epoch0 --save-dir=./save
python infer.py --model-name="TSN" --config=./configs/tsn.txt --filelist=./data/kinetics/infer.list \
python3 infer.py --model-name="TSN" --config=./configs/tsn.txt --filelist=./data/kinetics/infer.list \
--log-interval=10 --weights=./checkpoints/TSN_epoch0 --save-dir=./save
python test.py --model-name="NEXTVLAD" --config=./configs/nextvlad.txt \
python3 test.py --model-name="NEXTVLAD" --config=./configs/nextvlad.txt \
--log-interval=10 --weights=./checkpoints/NEXTVLAD_epoch0
python test.py --model-name="STNET" --config=./configs/stnet.txt \
python3 test.py --model-name="STNET" --config=./configs/stnet.txt \
--log-interval=10 --weights=./checkpoints/STNET_epoch0
python test.py --model-name="TSN" --config=./configs/tsn.txt \
python3 test.py --model-name="TSN" --config=./configs/tsn.txt \
--log-interval=10 --weights=./checkpoints/TSN_epoch0
export CUDA_VISIBLE_DEVICES=0,1,2,3
python train.py --model-name="NEXTVLAD" --config=./configs/nextvlad.txt --epoch-num=6 \
python3 train.py --model-name="NEXTVLAD" --config=./configs/nextvlad.txt --epoch-num=6 \
--valid-interval=1 --save-interval=1 --log-interval=10
python train.py --model-name="STNET" --config=./configs/stnet.txt --epoch-num=6 \
python3 train.py --model-name="STNET" --config=./configs/stnet.txt --epoch-num=6 \
--valid-interval=1 --save-interval=1 --log-interval=10
python train.py --model-name="TSN" --config=./configs/tsn.txt --epoch-num=6 \
python3 train.py --model-name="TSN" --config=./configs/tsn.txt --epoch-num=6 \
--valid-interval=1 --save-interval=1 --log-interval=10
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册