feat(research): preserve urban geometry pipelines and qualification suites
Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Scale-aware proposals only; downstream full-preset acceptance is unchanged.
|
||||
|
||||
Keep semantic silhouettes and local native-resolution paint as distinct
|
||||
hypotheses. Neither is itself accepted as map geometry.
|
||||
"""
|
||||
import cv2
|
||||
import numpy as np
|
||||
from component_targets import vector
|
||||
from glyph_targets import targets as original_targets
|
||||
from paint_channels import paint_mask
|
||||
|
||||
|
||||
def targets(image, patch, masks, scores, classes):
|
||||
result = original_targets(image, patch, masks, scores, classes)
|
||||
paint = paint_mask(image, cell=patch['mpp'])
|
||||
radius = max(1, round(.08 / patch['mpp']))
|
||||
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE,
|
||||
(2*radius+1, 2*radius+1))
|
||||
for i, (mask, score, cls) in enumerate(zip(masks, scores, classes)):
|
||||
if cls != 0 or score < .30:
|
||||
continue
|
||||
region = vector(mask, patch)
|
||||
expanded = cv2.dilate(mask.astype('uint8'), kernel) > 0
|
||||
for kind, target in [('semantic-silhouette', region),
|
||||
('native-paint', vector(paint & expanded, patch))]:
|
||||
if target.is_empty or target.area < .025:
|
||||
continue
|
||||
if any(x['ci'] == 0 and target.symmetric_difference(x['target']).area
|
||||
/ max(target.area, x['target'].area) < .04 for x in result):
|
||||
continue
|
||||
result.append(dict(target=target, ci=0, region=region,
|
||||
score=float(score), masks=[i], candidate_source=kind))
|
||||
return result
|
||||
Reference in New Issue
Block a user