feat: add standard peak grouping methods
This commit is contained in:
@@ -94,6 +94,7 @@
|
||||
<label class="field"><span>Grid preset</span><select id="grid-preset"><option value="50">50×50 · 기준</option><option value="100">100×100 · 4× points</option><option value="200">200×200 · 16× points</option><option value="custom">직접 입력</option></select></label>
|
||||
<label class="field"><span>Scene 거리 z (m)</span><input id="scene-distance" type="number" min="0.01" step="0.1" /></label>
|
||||
<label class="field" title="최강 peak 대비 검출 임계값입니다. 낮추면 약한 음원을 더 찾지만 sidelobe 오검출도 늘 수 있습니다."><span>Peak 임계값 (%)</span><input id="detection-threshold" type="number" min="1" max="100" step="1" /></label>
|
||||
<label class="field" title="원시 map은 바꾸지 않고, 임계값 위 영역을 peak로 묶는 표준 방식을 선택합니다."><span>Peak 묶기</span><select id="detection-method"><option value="local-max">Local maxima</option><option value="connected-components">8-connected components</option><option value="watershed">Marker watershed</option></select></label>
|
||||
</div>
|
||||
<p class="workload-summary" id="workload-summary">연산량 계산 중…</p>
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ const elements = {
|
||||
normalization: byId("normalization"),
|
||||
dynamicRange: byId("dynamic-range"),
|
||||
detectionThreshold: byId("detection-threshold"),
|
||||
detectionMethod: byId("detection-method"),
|
||||
addBandButton: byId("add-band-button"),
|
||||
bandList: byId("band-list"),
|
||||
exportSceneButton: byId("export-scene-button"),
|
||||
@@ -206,6 +207,9 @@ function applyExperimentDefaults(experiment) {
|
||||
if (experiment.evaluation.detectionThresholdRatio === undefined) {
|
||||
experiment.evaluation.detectionThresholdRatio = DEFAULT_DETECTION_THRESHOLD_RATIO;
|
||||
}
|
||||
if (experiment.evaluation.detectionMethod === undefined) {
|
||||
experiment.evaluation.detectionMethod = "local-max";
|
||||
}
|
||||
return experiment;
|
||||
}
|
||||
|
||||
@@ -426,6 +430,7 @@ function syncControls() {
|
||||
const detectionThresholdRatio =
|
||||
experiment.evaluation?.detectionThresholdRatio ?? DEFAULT_DETECTION_THRESHOLD_RATIO;
|
||||
elements.detectionThreshold.value = String(Number((detectionThresholdRatio * 100).toFixed(4)));
|
||||
elements.detectionMethod.value = experiment.evaluation?.detectionMethod ?? "local-max";
|
||||
elements.arrayPreset.value = ARRAY_PRESET_URLS.has(state.arrayDefinition.id)
|
||||
? state.arrayDefinition.id
|
||||
: "custom";
|
||||
@@ -781,6 +786,11 @@ function renderResult() {
|
||||
`${formatNumber(detectionThreshold * 100, 0)}%`,
|
||||
"최강 map 값 기준 · 낮을수록 민감",
|
||||
);
|
||||
appendMetric(
|
||||
"Peak 묶기",
|
||||
displayed.snapshot.experiment.evaluation?.detectionMethod ?? "local-max",
|
||||
"raw map 불변 · 검출 후보만 군집화",
|
||||
);
|
||||
for (const band of displayed.snapshot.experiment.frequencyBands) {
|
||||
const evaluation = displayed.evaluations.get(band.id);
|
||||
if (!evaluation) continue;
|
||||
@@ -1165,6 +1175,7 @@ async function runSimulation() {
|
||||
detectionThresholdRatio:
|
||||
snapshot.experiment.evaluation?.detectionThresholdRatio ??
|
||||
DEFAULT_DETECTION_THRESHOLD_RATIO,
|
||||
detectionMethod: snapshot.experiment.evaluation?.detectionMethod ?? "local-max",
|
||||
});
|
||||
evaluations.set(band.id, evaluation);
|
||||
exportedEvaluations.set(band.id, exportBandEvaluation(evaluation));
|
||||
@@ -1300,6 +1311,7 @@ function evaluateLiveFrames(snapshot, plan, frames) {
|
||||
detectionThresholdRatio:
|
||||
snapshot.experiment.evaluation?.detectionThresholdRatio ??
|
||||
DEFAULT_DETECTION_THRESHOLD_RATIO,
|
||||
detectionMethod: snapshot.experiment.evaluation?.detectionMethod ?? "local-max",
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -1758,6 +1770,11 @@ function installDocumentInputListeners() {
|
||||
state.experiment.evaluation.detectionThresholdRatio = value / 100;
|
||||
markChanged();
|
||||
});
|
||||
elements.detectionMethod.addEventListener("change", () => {
|
||||
state.experiment.evaluation ??= {};
|
||||
state.experiment.evaluation.detectionMethod = elements.detectionMethod.value;
|
||||
markChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function installBandListeners() {
|
||||
|
||||
Reference in New Issue
Block a user