def generate_inner_products_using_ip_split(net, step, filler): bottom_name = "dropout%d" % step generate_ip_split_layers(net, bottom_name, 250, "ip_conf%d" % step, 2) generate_ip_split_layers(net, bottom_name, 250, "ip_bbox_unscaled%d" % step, 4) net.f( Power("ip_bbox%d" % step, scale=100, bottoms=["ip_bbox_unscaled%d" % step])) net.f(Softmax("ip_soft_conf%d" % step, bottoms=["ip_conf%d" % step]))
def generate_intermediate_layers(net): """Takes the output from the decapitated googlenet and transforms the output from a NxCxWxH to (NxWxH)xCx1x1 that is used as input for the lstm layers. N = batch size, C = channels, W = grid width, H = grid height.""" net.f(Convolution("post_fc7_conv", bottoms=["inception_final_output"], param_lr_mults=[1., 2.], param_decay_mults=[0., 0.], num_output=1024, kernel_dim=(1, 1), weight_filler=Filler("gaussian", 0.005), bias_filler=Filler("constant", 0.))) net.f(Power("lstm_fc7_conv", scale=0.01, bottoms=["post_fc7_conv"])) net.f(Transpose("lstm_input", bottoms=["lstm_fc7_conv"]))
def generate_inner_products(net, step, filler): """Inner products are fully connected layers. They generate the final regressions for the confidence (ip_soft_conf), and the bounding boxes (ip_bbox)""" net.f(InnerProduct("ip_conf%d" % step, 2, bottoms=["dropout%d" % step], output_4d=True, weight_filler=filler)) net.f(InnerProduct("ip_bbox_unscaled%d" % step, 4, bottoms=["dropout%d" % step], output_4d=True, weight_filler=filler)) net.f(Power("ip_bbox%d" % step, scale=100, bottoms=["ip_bbox_unscaled%d" % step])) net.f(Softmax("ip_soft_conf%d" % step, bottoms=["ip_conf%d"%step]))