# Path: utils/custom_layers.py
# def abs_smooth(x):
# def abs_smooth_2(x):
# def l2_normalization(
#         inputs,
#         scaling=False,
#         scale_initializer=init_ops.ones_initializer(),
#         reuse=None,
#         variables_collections=None,
#         outputs_collections=None,
#         data_format='NHWC',
#         trainable=True,
#         scope=None):
# def pad2d(inputs,
#           pad=(0, 0),
#           mode='CONSTANT',
#           data_format='NHWC',
#           trainable=True,
#           scope=None):
# def channel_to_last(inputs,
#                     data_format='NHWC',
#                     scope=None):
# def dropout_with_noise(net):
# 
# Path: ssd/ssd_utils.py
# def tensor_shape(x, rank=3):
# def multibox_layer(inputs, num_classes, anchor_sizes, anchor_ratios, normalization):
# def compute_jaccard(gt_bboxes, anchors):
# def anchor_one_layer(img_shape, feat_shape, sizes, ratios, step, offset=0.5, dtype=np.float32):
# def arg_scope(weight_decay=0.0005, data_format='NHWC'):
# def bboxes_encode_layer(labels,
#                         bboxes,
#                         anchors_layer,
#                         num_classes,
#                         prior_scaling=[0.1, 0.1, 0.2, 0.2],
#                         dtype=tf.float32):
#     def jaccard_with_anchors(bbox):
#     def intersection_with_anchors(bbox):
#     def condition(i, feat_labels, feat_scores,
#                   feat_ymin, feat_xmin, feat_ymax, feat_xmax):
#     def body(i, feat_labels, feat_scores,
#              feat_ymin, feat_xmin, feat_ymax, feat_xmax):
# def _bboxes_decode_layer(feat_localizations,
#                                anchors_layer,
#                                prior_scaling=[0.1, 0.1, 0.2, 0.2]):
# def bboxes_decode(feat_localizations,
#                          anchors,
#                          prior_scaling=[0.1, 0.1, 0.2, 0.2],
#                          scope='ssd_bboxes_decode'):
# def _match_no_miss(gt_anchor_labels, gt_anchor_bboxes, gt_anchor_scores, jaccard, gt_labels, gt_bboxes, num_anchors):
#     def cond(i, gt_anchors_labels, gt_anchors_bboxes, gt_anchors_scores):
#     def body(i, gt_anchors_labels, gt_anchors_bboxes, gt_anchors_scores):
# def match_no_labels(gt_anchor_labels, gt_anchor_bboxes, gt_anchor_scores, jaccard, matching_threshold,
#                       gt_labels, gt_bboxes, num_anchors):
# def match_with_labels(gt_anchor_labels, gt_anchor_bboxes, gt_anchor_scores, jaccard, matching_threshold,
#                         gt_labels, gt_bboxes, num_anchors):
# def _bboxes_select_layer(predictions_layer, localizations_layer,
#                         select_threshold=None,
#                         num_classes=21,
#                         ignore_class=0,
#                         scope=None):
# def bboxes_select(predictions_net, localizations_net,
#                   select_threshold=None,
#                   num_classes=21,
#                   ignore_class=0,
#                   scope=None):


import tensorflow as tf
from utils import custom_layers
from ssd.ssd_utils import SSDParams

slim = tf.contrib.slim

ssd300_params = SSDParams(model_name='ssd300',
                          img_shape=(300, 300),
                          num_classes=21,
                          no_annotation_label=21,
                          feature_layers=['ssd_block7', 'ssd_block8', 'ssd_block9', 'ssd_block10', 'ssd_block11'],
                          feature_shapes=[(38, 38), (19, 19), (10, 10), (5, 5), (3, 3), (1, 1)],
                          anchor_size_bounds=[0.15, 0.90],
                          anchor_sizes=[(21., 45.),
                                        (45., 99.),
                                        (99., 153.),
                                        (153., 207.),
                                        (207., 261.),
                                        (261., 315.)],
                          anchor_ratios=[[2, .5],
                                         [2, .5, 3, 1. / 3],
                                         [2, .5, 3, 1. / 3],
                                         [2, .5, 3, 1. / 3],
                                         [2, .5],
                                         [2, .5]],
                          anchor_steps=[8, 16, 32, 64, 100, 300],
                          anchor_offset=0.5,
                          normalizations=[20, -1, -1, -1, -1, -1],
                          prior_scaling=[0.1, 0.1, 0.2, 0.2]
                          )



# Path: utils/custom_layers.py
# def abs_smooth(x):
# def abs_smooth_2(x):
# def l2_normalization(
#         inputs,
#         scaling=False,
#         scale_initializer=init_ops.ones_initializer(),
#         reuse=None,
#         variables_collections=None,
#         outputs_collections=None,
#         data_format='NHWC',
#         trainable=True,
#         scope=None):
# def pad2d(inputs,
#           pad=(0, 0),
#           mode='CONSTANT',
#           data_format='NHWC',
#           trainable=True,
#           scope=None):
# def channel_to_last(inputs,
#                     data_format='NHWC',
#                     scope=None):
# def dropout_with_noise(net):
# 
# Path: ssd/ssd_utils.py
# def tensor_shape(x, rank=3):
# def multibox_layer(inputs, num_classes, anchor_sizes, anchor_ratios, normalization):
# def compute_jaccard(gt_bboxes, anchors):
# def anchor_one_layer(img_shape, feat_shape, sizes, ratios, step, offset=0.5, dtype=np.float32):
# def arg_scope(weight_decay=0.0005, data_format='NHWC'):
# def bboxes_encode_layer(labels,
#                         bboxes,
#                         anchors_layer,
#                         num_classes,
#                         prior_scaling=[0.1, 0.1, 0.2, 0.2],
#                         dtype=tf.float32):
#     def jaccard_with_anchors(bbox):
#     def intersection_with_anchors(bbox):
#     def condition(i, feat_labels, feat_scores,
#                   feat_ymin, feat_xmin, feat_ymax, feat_xmax):
#     def body(i, feat_labels, feat_scores,
#              feat_ymin, feat_xmin, feat_ymax, feat_xmax):
# def _bboxes_decode_layer(feat_localizations,
#                                anchors_layer,
#                                prior_scaling=[0.1, 0.1, 0.2, 0.2]):
# def bboxes_decode(feat_localizations,
#                          anchors,
#                          prior_scaling=[0.1, 0.1, 0.2, 0.2],
#                          scope='ssd_bboxes_decode'):
# def _match_no_miss(gt_anchor_labels, gt_anchor_bboxes, gt_anchor_scores, jaccard, gt_labels, gt_bboxes, num_anchors):
#     def cond(i, gt_anchors_labels, gt_anchors_bboxes, gt_anchors_scores):
#     def body(i, gt_anchors_labels, gt_anchors_bboxes, gt_anchors_scores):
# def match_no_labels(gt_anchor_labels, gt_anchor_bboxes, gt_anchor_scores, jaccard, matching_threshold,
#                       gt_labels, gt_bboxes, num_anchors):
# def match_with_labels(gt_anchor_labels, gt_anchor_bboxes, gt_anchor_scores, jaccard, matching_threshold,
#                         gt_labels, gt_bboxes, num_anchors):
# def _bboxes_select_layer(predictions_layer, localizations_layer,
#                         select_threshold=None,
#                         num_classes=21,
#                         ignore_class=0,
#                         scope=None):
# def bboxes_select(predictions_net, localizations_net,
#                   select_threshold=None,
#                   num_classes=21,
#                   ignore_class=0,
#                   scope=None):


# Path: ssd/ssd_blocks.py
import tensorflow as tf
from utils import custom_layers
from ssd.ssd_utils import SSDParams


slim = tf.contrib.slim

ssd300_params = SSDParams(model_name='ssd300',
                          img_shape=(300, 300),
                          num_classes=21,
                          no_annotation_label=21,
                          feature_layers=['ssd_block7', 'ssd_block8', 'ssd_block9', 'ssd_block10', 'ssd_block11'],
                          feature_shapes=[(38, 38), (19, 19), (10, 10), (5, 5), (3, 3), (1, 1)],
                          anchor_size_bounds=[0.15, 0.90],
                          anchor_sizes=[(21., 45.),
                                        (45., 99.),
                                        (99., 153.),
                                        (153., 207.),
                                        (207., 261.),
                                        (261., 315.)],
                          anchor_ratios=[[2, .5],
                                         [2, .5, 3, 1. / 3],
                                         [2, .5, 3, 1. / 3],
                                         [2, .5, 3, 1. / 3],
                                         [2, .5],
                                         [2, .5]],
                          anchor_steps=[8, 16, 32, 64, 100, 300],
                          anchor_offset=0.5,
                          normalizations=[20, -1, -1, -1, -1, -1],
                          prior_scaling=[0.1, 0.1, 0.2, 0.2]
                          )



ssd512_params = SSDParams(model_name='ssd512',