From f48b63546a9eeef5d0eb2cfefd16bd98a3713b85 Mon Sep 17 00:00:00 2001 From: nttstar Date: Wed, 16 Oct 2019 14:33:35 +0800 Subject: [PATCH] add SFC output header --- recognition/symbol/symbol_utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/recognition/symbol/symbol_utils.py b/recognition/symbol/symbol_utils.py index 470880e..1bf22d7 100644 --- a/recognition/symbol/symbol_utils.py +++ b/recognition/symbol/symbol_utils.py @@ -41,6 +41,17 @@ def get_fc1(last_conv, num_classes, fc_type, input_channel=512): body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bn1') fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='pre_fc1') fc1 = mx.sym.BatchNorm(data=fc1, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='fc1') + elif fc_type=='SFC': + body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bn1') + body = Conv(data=body, num_filter=input_channel, kernel=(3,3), stride=(2,2), pad=(1,1), + no_bias=True, name="convf", num_group = input_channel) + body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bnf') + body = Act(data=body, act_type=config.net_act, name='reluf') + body = Conv(data=body, num_filter=input_channel, kernel=(1, 1), pad=(0, 0), stride=(1, 1), name="convf2") + body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bnf2') + body = Act(data=body, act_type=config.net_act, name='reluf2') + fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='pre_fc1') + fc1 = mx.sym.BatchNorm(data=fc1, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='fc1') elif fc_type=='GAP': bn1 = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bn1') relu1 = Act(data=bn1, act_type=config.net_act, name='relu1')