ssds.modeling.layers

ssds.modeling.layers.box

ssds.modeling.layers.box.box2delta(boxes, anchors)[source]

Convert boxes to deltas from anchors

ssds.modeling.layers.box.configure_ratio_scale(num_featmaps, ratios, scales)[source]

Get the apect ratio and scale for the default anchor boxes

From v.15, ssds.pytorch does not consider the enlarged 1:1 anchor box in the original ssd or tf version

ssds.modeling.layers.box.decode(all_cls_head, all_box_head, stride=1, threshold=0.05, top_n=1000, anchors=None, rescore=True)[source]

Box Decoding and Filtering

ssds.modeling.layers.box.delta2box(deltas, anchors, size, stride)[source]

Convert deltas from anchors to boxes

ssds.modeling.layers.box.extract_targets(targets, anchors, classes, stride, size, match=[0.5, 0.4], center_sampling_radius=0, is_centerness=False)[source]

snap the targets to anchors

ssds.modeling.layers.box.generate_anchors(stride, ratio_vals, scales_vals)[source]

Generate anchors coordinates from scales/ratios

ssds.modeling.layers.box.get_sample_region(boxes, stride, anchor_points, radius=1.5)[source]

This code is from https://github.com/yqyao/FCOS_PLUS/blob/0d20ba34ccc316650d8c30febb2eb40cb6eaae37/ maskrcnn_benchmark/modeling/rpn/fcos/loss.py#L42

ssds.modeling.layers.box.nms(all_scores, all_boxes, all_classes, nms=0.5, ndetections=100, using_diou=True)[source]

Non Maximum Suppression

ssds.modeling.layers.box.snap_to_anchors_by_iou(boxes, size, stride, anchors, num_classes, match, center_sampling_radius, is_centerness, device)[source]

Snap target boxes (x, y, w, h) to anchors by the iou between target boxes and anchors

ssds.modeling.layers.box.snap_to_anchors_by_scale(boxes, size, stride, anchors, num_classes, match, center_sampling_radius, is_centerness, device)[source]

Snap target boxes (x, y, w, h) to anchors by the scale of target boxes

ssds.modeling.layers.decoder

class ssds.modeling.layers.decoder.Decoder(conf_threshold, nms_threshold, top_n, top_n_per_level, rescore, use_diou)[source]

Bases: object

class Decoder contains the decoder func and nms func

__call__(loc, conf, anchors)[source]

Decode and filter boxes

Returns

out_scores, (batch, top_n)

out_boxes, (batch, top_n, 4) with ltrb format

out_classes, (batch, top_n)