def merge_outputs(self, detections):
    results = {}
    for j in range(1, (self.num_classes + 1)):
        results[j] = np.concatenate([detection[j] for detection in detections], axis=0).astype(np.float32)
        if ((len(self.scales) > 1) or self.opt.nms):
            soft_nms(results[j], Nt=0.5, method=2)
    scores = np.hstack([results[j][:, 4] for j in range(1, (self.num_classes + 1))])
    if (len(scores) > self.max_per_image):
        kth = (len(scores) - self.max_per_image)
        thresh = np.partition(scores, kth)[kth]
        for j in range(1, (self.num_classes + 1)):
            keep_inds = (results[j][:, 4] >= thresh)
            results[j] = results[j][keep_inds]
    return results
def merge_outputs(self, detections):
    results = {}
    for j in range(1, (self.num_classes + 1)):
        results[j] = np.concatenate([detection[j] for detection in detections], axis=0).astype(np.float32)
        if ((len(self.scales) > 1) or self.opt.nms):
            soft_nms(results[j], Nt=0.5, method=2)
    scores = np.hstack([results[j][:, 4] for j in range(1, (self.num_classes + 1))])
    if (len(scores) > self.max_per_image):
        kth = (len(scores) - self.max_per_image)
        thresh = np.partition(scores, kth)[kth]
        for j in range(1, (self.num_classes + 1)):
            keep_inds = (results[j][:, 4] >= thresh)
            results[j] = results[j][keep_inds]
    return results