in sagemaker/src/word_and_line_segmentation.py [0:0]
def __init__(self, num_classes, ctx, **kwargs):
super(SSD, self).__init__(**kwargs)
# Seven sets of anchor boxes are defined. For each set, n=2 sizes and m=3 ratios are defined.
# Four anchor boxes (n + m - 1) are generated: 2 square anchor boxes based on the n=2 sizes and 2 rectanges based on
# the sizes and the ratios. See https://discuss.mxnet.io/t/question-regarding-ssd-algorithm/1307 for more information.
#self.anchor_sizes = [[.1, .2], [.2, .3], [.2, .4], [.4, .6], [.5, .7], [.6, .8], [.7, .9]]
#self.anchor_ratios = [[1, 3, 5], [1, 3, 5], [1, 6, 8], [1, 5, 7], [1, 6, 8], [1, 7, 9], [1, 7, 10]]
self.anchor_sizes = [[.1, .2], [.2, .3], [.2, .4], [.3, .4], [.3, .5], [.4, .6]]
self.anchor_ratios = [[1, 3, 5], [1, 3, 5], [1, 6, 8], [1, 4, 7], [1, 6, 8], [1, 5, 7]]
self.num_anchors = len(self.anchor_sizes)
self.num_classes = num_classes
self.ctx = ctx
with self.name_scope():
self.body, self.downsamples, self.class_preds, self.box_preds = self.get_ssd_model()
self.downsamples.initialize(mx.init.Normal(), ctx=self.ctx)
self.class_preds.initialize(mx.init.Normal(), ctx=self.ctx)
self.box_preds.initialize(mx.init.Normal(), ctx=self.ctx)