scorevision: push artifact
Browse files367 unmodified lines3683693703713723731 unmodified line375376377378379380381367 unmodified lineskept.append(box)return kept@classmethoddef _apply_rules(cls, results, image_width, image=None):results = cls._filter_glove_by_color(results, image)1 unmodified lineresults = cls._filter_weak_glove_with_strong_others(results)results = cls._filter_split_glove_confidence(results)results = cls._filter_crowded_gloves(results)return cls._filter_orphan_low_conf_spray(results)def _predict_single(self, image):x, ratio, pad, orig_size = self._preprocess(image)367 unmodified lines3683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024031 unmodified line405406407408409410411412367 unmodified lineskept.append(box)return kept@classmethoddef _box_iou_pair(cls, a, b):inter = cls._box_intersection_area(a, b)aw = max(0.0, float(a.x2 - a.x1)) * max(0.0, float(a.y2 - a.y1))bw = max(0.0, float(b.x2 - b.x1)) * max(0.0, float(b.y2 - b.y1))union = aw + bw - interif union <= 0: return 0.0return inter / union@classmethoddef _aggressive_dedup_balaclava_graffiti(cls, results, iou_thr=0.10):"""For balaclava (cls 0) and graffiti (cls 5), drop lower-conf boxwhenever any two boxes of the same class overlap > iou_thr.Rationale: one face = one balaclava; one tag = one graffiti box."""target = {0, 5}others = [b for b in results if b.cls_id not in target]by_cls = {}for b in results:if b.cls_id in target:by_cls.setdefault(b.cls_id, []).append(b)kept = list(others)for cid, boxes in by_cls.items():boxes_sorted = sorted(boxes, key=lambda b: -b.conf)survivors = []for b in boxes_sorted:if all(cls._box_iou_pair(b, k) < iou_thr for k in survivors):survivors.append(b)kept.extend(survivors)return kept@classmethoddef _apply_rules(cls, results, image_width, image=None):results = cls._filter_glove_by_color(results, image)1 unmodified lineresults = cls._filter_weak_glove_with_strong_others(results)results = cls._filter_split_glove_confidence(results)results = cls._filter_crowded_gloves(results)results = cls._filter_orphan_low_conf_spray(results)return cls._aggressive_dedup_balaclava_graffiti(results)def _predict_single(self, image):x, ratio, pad, orig_size = self._preprocess(image)
miner.py+32-1