def __decode_detections(self, out, frame_shape):
    'Decodes raw SSD output'
    detections = []
    for detection in out[(0, 0)]:
        confidence = detection[2]
        if (confidence > self.confidence):
            left = int((max(detection[3], 0) * frame_shape[1]))
            top = int((max(detection[4], 0) * frame_shape[0]))
            right = int((max(detection[5], 0) * frame_shape[1]))
            bottom = int((max(detection[6], 0) * frame_shape[0]))
            if (self.expand_ratio != (1.0, 1.0)):
                w = (right - left)
                h = (bottom - top)
                dw = ((w * (self.expand_ratio[0] - 1.0)) / 2)
                dh = ((h * (self.expand_ratio[1] - 1.0)) / 2)
                left = max(int((left - dw)), 0)
                right = int((right + dw))
                top = max(int((top - dh)), 0)
                bottom = int((bottom + dh))
            detections.append(((left, top, right, bottom), confidence))
    if (len(detections) > 1):
        detections.sort(key=(lambda x: x[1]), reverse=True)
    return detections
Decodes raw SSD output
def __decode_detections(self, out, frame_shape):
    
    detections = []
    for detection in out[(0, 0)]:
        confidence = detection[2]
        if (confidence > self.confidence):
            left = int((max(detection[3], 0) * frame_shape[1]))
            top = int((max(detection[4], 0) * frame_shape[0]))
            right = int((max(detection[5], 0) * frame_shape[1]))
            bottom = int((max(detection[6], 0) * frame_shape[0]))
            if (self.expand_ratio != (1.0, 1.0)):
                w = (right - left)
                h = (bottom - top)
                dw = ((w * (self.expand_ratio[0] - 1.0)) / 2)
                dh = ((h * (self.expand_ratio[1] - 1.0)) / 2)
                left = max(int((left - dw)), 0)
                right = int((right + dw))
                top = max(int((top - dh)), 0)
                bottom = int((bottom + dh))
            detections.append(((left, top, right, bottom), confidence))
    if (len(detections) > 1):
        detections.sort(key=(lambda x: x[1]), reverse=True)
    return detections