Spaces:
Runtime error
Runtime error
Khunndev Cursor commited on
Commit ·
6544822
1
Parent(s): 2b21a73
Add debug mode to show confidence scores inside detection circles.
Browse files- frontend/src/App.tsx +10 -0
- frontend/src/components/ResultCanvas.tsx +19 -4
- frontend/src/components/SettingsDrawer.tsx +6 -0
- frontend/src/components/SettingsPanel.tsx +16 -0
- frontend/src/components/StepResults.tsx +3 -0
- frontend/src/lib/debugSettings.ts +17 -0
- frontend/src/lib/i18n.ts +6 -0
- frontend/src/lib/types.ts +3 -0
frontend/src/App.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { ASSETS } from './lib/assets'
|
|
| 4 |
import { assignDiameterGroups, countByGroup } from './lib/clustering'
|
| 5 |
import { getActiveBackend, isLowMemoryDevice, loadModel, runDetection } from './lib/inference'
|
| 6 |
import { loadInferenceMode, saveInferenceMode } from './lib/inferenceSettings'
|
|
|
|
| 7 |
import { getServerBackend, isServerTimeoutError, probeServerDetect, serverDetect } from './lib/serverDetect'
|
| 8 |
import { t } from './lib/i18n'
|
| 9 |
import { applyCrop, type CropRect } from './lib/cropImage'
|
|
@@ -51,6 +52,7 @@ export default function App() {
|
|
| 51 |
const [groupCount, setGroupCount] = useState<number | 'auto'>(1)
|
| 52 |
const [useTiling, setUseTiling] = useState(true)
|
| 53 |
const [filterOutliers, setFilterOutliers] = useState(false)
|
|
|
|
| 54 |
|
| 55 |
// ui state
|
| 56 |
const [engine, setEngine] = useState<Engine>('checking')
|
|
@@ -135,6 +137,11 @@ export default function App() {
|
|
| 135 |
setInferenceMode(mode)
|
| 136 |
}
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
const revokeIfBlob = (url: string) => {
|
| 139 |
if (url.startsWith('blob:')) URL.revokeObjectURL(url)
|
| 140 |
}
|
|
@@ -416,6 +423,7 @@ export default function App() {
|
|
| 416 |
detections={detections}
|
| 417 |
groups={groups}
|
| 418 |
counts={counts}
|
|
|
|
| 419 |
onUpdate={setDetections}
|
| 420 |
onExpectedChange={handleExpectedChange}
|
| 421 |
onRecount={() => navigate('crop')}
|
|
@@ -435,10 +443,12 @@ export default function App() {
|
|
| 435 |
serverAvailable={serverAvailable}
|
| 436 |
useTiling={useTiling}
|
| 437 |
filterOutliers={filterOutliers}
|
|
|
|
| 438 |
onGroupCount={setGroupCount}
|
| 439 |
onInferenceMode={handleInferenceMode}
|
| 440 |
onUseTiling={setUseTiling}
|
| 441 |
onFilterOutliers={setFilterOutliers}
|
|
|
|
| 442 |
onRecluster={recluster}
|
| 443 |
/>
|
| 444 |
|
|
|
|
| 4 |
import { assignDiameterGroups, countByGroup } from './lib/clustering'
|
| 5 |
import { getActiveBackend, isLowMemoryDevice, loadModel, runDetection } from './lib/inference'
|
| 6 |
import { loadInferenceMode, saveInferenceMode } from './lib/inferenceSettings'
|
| 7 |
+
import { loadShowConfidenceLabels, saveShowConfidenceLabels } from './lib/debugSettings'
|
| 8 |
import { getServerBackend, isServerTimeoutError, probeServerDetect, serverDetect } from './lib/serverDetect'
|
| 9 |
import { t } from './lib/i18n'
|
| 10 |
import { applyCrop, type CropRect } from './lib/cropImage'
|
|
|
|
| 52 |
const [groupCount, setGroupCount] = useState<number | 'auto'>(1)
|
| 53 |
const [useTiling, setUseTiling] = useState(true)
|
| 54 |
const [filterOutliers, setFilterOutliers] = useState(false)
|
| 55 |
+
const [showConfidenceLabels, setShowConfidenceLabels] = useState(loadShowConfidenceLabels)
|
| 56 |
|
| 57 |
// ui state
|
| 58 |
const [engine, setEngine] = useState<Engine>('checking')
|
|
|
|
| 137 |
setInferenceMode(mode)
|
| 138 |
}
|
| 139 |
|
| 140 |
+
const handleShowConfidenceLabels = (enabled: boolean) => {
|
| 141 |
+
saveShowConfidenceLabels(enabled)
|
| 142 |
+
setShowConfidenceLabels(enabled)
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
const revokeIfBlob = (url: string) => {
|
| 146 |
if (url.startsWith('blob:')) URL.revokeObjectURL(url)
|
| 147 |
}
|
|
|
|
| 423 |
detections={detections}
|
| 424 |
groups={groups}
|
| 425 |
counts={counts}
|
| 426 |
+
showConfidenceLabels={showConfidenceLabels}
|
| 427 |
onUpdate={setDetections}
|
| 428 |
onExpectedChange={handleExpectedChange}
|
| 429 |
onRecount={() => navigate('crop')}
|
|
|
|
| 443 |
serverAvailable={serverAvailable}
|
| 444 |
useTiling={useTiling}
|
| 445 |
filterOutliers={filterOutliers}
|
| 446 |
+
showConfidenceLabels={showConfidenceLabels}
|
| 447 |
onGroupCount={setGroupCount}
|
| 448 |
onInferenceMode={handleInferenceMode}
|
| 449 |
onUseTiling={setUseTiling}
|
| 450 |
onFilterOutliers={setFilterOutliers}
|
| 451 |
+
onShowConfidenceLabels={handleShowConfidenceLabels}
|
| 452 |
onRecluster={recluster}
|
| 453 |
/>
|
| 454 |
|
frontend/src/components/ResultCanvas.tsx
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
*/
|
| 6 |
import { useEffect, useRef, useState } from 'react'
|
| 7 |
import { isLowMemoryDevice } from '../lib/inference'
|
| 8 |
-
import type { Detection, DiameterGroup, ToolMode } from '../lib/types'
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Render scale for the result canvas.
|
|
@@ -68,6 +68,18 @@ function spatialLabelMap(detections: Detection[]): Map<string, number> {
|
|
| 68 |
return map
|
| 69 |
}
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
function computeStagger(count: number): { staggerMs: number; durationMs: number } {
|
| 72 |
if (count <= 500) return { staggerMs: 8, durationMs: 220 }
|
| 73 |
if (count <= 1000) return { staggerMs: 4, durationMs: 150 }
|
|
@@ -220,6 +232,8 @@ interface Props {
|
|
| 220 |
animate?: boolean
|
| 221 |
/** Number labels inside circles — hide during intro animation, show on results dock. */
|
| 222 |
showCircleLabels?: boolean
|
|
|
|
|
|
|
| 223 |
onUpdate: (dets: Detection[]) => void
|
| 224 |
onCanvasReady?: (canvas: HTMLCanvasElement | null) => void
|
| 225 |
onAnimationComplete?: () => void
|
|
@@ -236,6 +250,7 @@ export function ResultCanvas({
|
|
| 236 |
displayBounds,
|
| 237 |
animate = false,
|
| 238 |
showCircleLabels = true,
|
|
|
|
| 239 |
onUpdate,
|
| 240 |
onCanvasReady,
|
| 241 |
onAnimationComplete,
|
|
@@ -464,7 +479,7 @@ export function ResultCanvas({
|
|
| 464 |
const cx = d.xmin + pw / 2
|
| 465 |
const cy = d.ymin + ph / 2
|
| 466 |
const radius = fitRadius(pw, ph, minR)
|
| 467 |
-
const label =
|
| 468 |
drawCircle(ctx, cx, cy, radius, rgb, 1, label, showLabels && Boolean(label), displayPx)
|
| 469 |
})
|
| 470 |
|
|
@@ -479,7 +494,7 @@ export function ResultCanvas({
|
|
| 479 |
ctx.strokeRect(area.x1, area.y1, area.x2 - area.x1, area.y2 - area.y1)
|
| 480 |
ctx.restore()
|
| 481 |
}
|
| 482 |
-
}, [animating, image, detections, groups, displayBounds, showCircleLabels])
|
| 483 |
|
| 484 |
// -------------------------------------------------------------------------
|
| 485 |
// direct canvas redraw — does NOT go through React state / onUpdate
|
|
@@ -512,7 +527,7 @@ export function ResultCanvas({
|
|
| 512 |
const rgb = hexToRgb(group?.color ?? '#ef4444')
|
| 513 |
const pw = d.xmax - d.xmin
|
| 514 |
const ph = d.ymax - d.ymin
|
| 515 |
-
const label =
|
| 516 |
drawCircle(
|
| 517 |
ctx,
|
| 518 |
d.xmin + pw / 2,
|
|
|
|
| 5 |
*/
|
| 6 |
import { useEffect, useRef, useState } from 'react'
|
| 7 |
import { isLowMemoryDevice } from '../lib/inference'
|
| 8 |
+
import type { Detection, DiameterGroup, CircleLabelMode, ToolMode } from '../lib/types'
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Render scale for the result canvas.
|
|
|
|
| 68 |
return map
|
| 69 |
}
|
| 70 |
|
| 71 |
+
function detectionCircleLabel(
|
| 72 |
+
d: Detection,
|
| 73 |
+
mode: 'count' | 'confidence',
|
| 74 |
+
countLabels: Map<string, number>,
|
| 75 |
+
): string {
|
| 76 |
+
if (mode === 'confidence') {
|
| 77 |
+
return d.confidence.toFixed(2)
|
| 78 |
+
}
|
| 79 |
+
const n = countLabels.get(d.id)
|
| 80 |
+
return n !== undefined ? String(n) : ''
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
function computeStagger(count: number): { staggerMs: number; durationMs: number } {
|
| 84 |
if (count <= 500) return { staggerMs: 8, durationMs: 220 }
|
| 85 |
if (count <= 1000) return { staggerMs: 4, durationMs: 150 }
|
|
|
|
| 232 |
animate?: boolean
|
| 233 |
/** Number labels inside circles — hide during intro animation, show on results dock. */
|
| 234 |
showCircleLabels?: boolean
|
| 235 |
+
/** Show spatial count (default) or model confidence for debugging. */
|
| 236 |
+
circleLabelMode?: CircleLabelMode
|
| 237 |
onUpdate: (dets: Detection[]) => void
|
| 238 |
onCanvasReady?: (canvas: HTMLCanvasElement | null) => void
|
| 239 |
onAnimationComplete?: () => void
|
|
|
|
| 250 |
displayBounds,
|
| 251 |
animate = false,
|
| 252 |
showCircleLabels = true,
|
| 253 |
+
circleLabelMode = 'count',
|
| 254 |
onUpdate,
|
| 255 |
onCanvasReady,
|
| 256 |
onAnimationComplete,
|
|
|
|
| 479 |
const cx = d.xmin + pw / 2
|
| 480 |
const cy = d.ymin + ph / 2
|
| 481 |
const radius = fitRadius(pw, ph, minR)
|
| 482 |
+
const label = detectionCircleLabel(d, circleLabelMode, labels)
|
| 483 |
drawCircle(ctx, cx, cy, radius, rgb, 1, label, showLabels && Boolean(label), displayPx)
|
| 484 |
})
|
| 485 |
|
|
|
|
| 494 |
ctx.strokeRect(area.x1, area.y1, area.x2 - area.x1, area.y2 - area.y1)
|
| 495 |
ctx.restore()
|
| 496 |
}
|
| 497 |
+
}, [animating, image, detections, groups, displayBounds, showCircleLabels, circleLabelMode])
|
| 498 |
|
| 499 |
// -------------------------------------------------------------------------
|
| 500 |
// direct canvas redraw — does NOT go through React state / onUpdate
|
|
|
|
| 527 |
const rgb = hexToRgb(group?.color ?? '#ef4444')
|
| 528 |
const pw = d.xmax - d.xmin
|
| 529 |
const ph = d.ymax - d.ymin
|
| 530 |
+
const label = detectionCircleLabel(d, circleLabelMode, labels)
|
| 531 |
drawCircle(
|
| 532 |
ctx,
|
| 533 |
d.xmin + pw / 2,
|
frontend/src/components/SettingsDrawer.tsx
CHANGED
|
@@ -12,10 +12,12 @@ interface Props {
|
|
| 12 |
serverAvailable: boolean
|
| 13 |
useTiling: boolean
|
| 14 |
filterOutliers: boolean
|
|
|
|
| 15 |
onGroupCount: (value: number | 'auto') => void
|
| 16 |
onInferenceMode: (mode: InferenceMode) => void
|
| 17 |
onUseTiling: (value: boolean) => void
|
| 18 |
onFilterOutliers: (value: boolean) => void
|
|
|
|
| 19 |
onRecluster: () => void
|
| 20 |
}
|
| 21 |
|
|
@@ -28,10 +30,12 @@ export function SettingsDrawer({
|
|
| 28 |
serverAvailable,
|
| 29 |
useTiling,
|
| 30 |
filterOutliers,
|
|
|
|
| 31 |
onGroupCount,
|
| 32 |
onInferenceMode,
|
| 33 |
onUseTiling,
|
| 34 |
onFilterOutliers,
|
|
|
|
| 35 |
onRecluster,
|
| 36 |
}: Props) {
|
| 37 |
if (!open) return null
|
|
@@ -69,10 +73,12 @@ export function SettingsDrawer({
|
|
| 69 |
serverAvailable={serverAvailable}
|
| 70 |
useTiling={useTiling}
|
| 71 |
filterOutliers={filterOutliers}
|
|
|
|
| 72 |
onGroupCount={onGroupCount}
|
| 73 |
onInferenceMode={onInferenceMode}
|
| 74 |
onUseTiling={onUseTiling}
|
| 75 |
onFilterOutliers={onFilterOutliers}
|
|
|
|
| 76 |
onRecluster={onRecluster}
|
| 77 |
/>
|
| 78 |
</div>
|
|
|
|
| 12 |
serverAvailable: boolean
|
| 13 |
useTiling: boolean
|
| 14 |
filterOutliers: boolean
|
| 15 |
+
showConfidenceLabels: boolean
|
| 16 |
onGroupCount: (value: number | 'auto') => void
|
| 17 |
onInferenceMode: (mode: InferenceMode) => void
|
| 18 |
onUseTiling: (value: boolean) => void
|
| 19 |
onFilterOutliers: (value: boolean) => void
|
| 20 |
+
onShowConfidenceLabels: (value: boolean) => void
|
| 21 |
onRecluster: () => void
|
| 22 |
}
|
| 23 |
|
|
|
|
| 30 |
serverAvailable,
|
| 31 |
useTiling,
|
| 32 |
filterOutliers,
|
| 33 |
+
showConfidenceLabels,
|
| 34 |
onGroupCount,
|
| 35 |
onInferenceMode,
|
| 36 |
onUseTiling,
|
| 37 |
onFilterOutliers,
|
| 38 |
+
onShowConfidenceLabels,
|
| 39 |
onRecluster,
|
| 40 |
}: Props) {
|
| 41 |
if (!open) return null
|
|
|
|
| 73 |
serverAvailable={serverAvailable}
|
| 74 |
useTiling={useTiling}
|
| 75 |
filterOutliers={filterOutliers}
|
| 76 |
+
showConfidenceLabels={showConfidenceLabels}
|
| 77 |
onGroupCount={onGroupCount}
|
| 78 |
onInferenceMode={onInferenceMode}
|
| 79 |
onUseTiling={onUseTiling}
|
| 80 |
onFilterOutliers={onFilterOutliers}
|
| 81 |
+
onShowConfidenceLabels={onShowConfidenceLabels}
|
| 82 |
onRecluster={onRecluster}
|
| 83 |
/>
|
| 84 |
</div>
|
frontend/src/components/SettingsPanel.tsx
CHANGED
|
@@ -10,10 +10,12 @@ interface Props {
|
|
| 10 |
serverAvailable: boolean
|
| 11 |
useTiling: boolean
|
| 12 |
filterOutliers: boolean
|
|
|
|
| 13 |
onGroupCount: (value: number | 'auto') => void
|
| 14 |
onInferenceMode: (mode: InferenceMode) => void
|
| 15 |
onUseTiling: (value: boolean) => void
|
| 16 |
onFilterOutliers: (value: boolean) => void
|
|
|
|
| 17 |
onRecluster: () => void
|
| 18 |
}
|
| 19 |
|
|
@@ -70,10 +72,12 @@ export function SettingsPanel({
|
|
| 70 |
serverAvailable,
|
| 71 |
useTiling,
|
| 72 |
filterOutliers,
|
|
|
|
| 73 |
onGroupCount,
|
| 74 |
onInferenceMode,
|
| 75 |
onUseTiling,
|
| 76 |
onFilterOutliers,
|
|
|
|
| 77 |
onRecluster,
|
| 78 |
}: Props) {
|
| 79 |
return (
|
|
@@ -164,6 +168,18 @@ export function SettingsPanel({
|
|
| 164 |
</div>
|
| 165 |
</section>
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
<section>
|
| 168 |
<p className="ct-section-label mb-2 px-1">{t(lang, 'updateApp')}</p>
|
| 169 |
<div className="ct-card overflow-hidden p-3">
|
|
|
|
| 10 |
serverAvailable: boolean
|
| 11 |
useTiling: boolean
|
| 12 |
filterOutliers: boolean
|
| 13 |
+
showConfidenceLabels: boolean
|
| 14 |
onGroupCount: (value: number | 'auto') => void
|
| 15 |
onInferenceMode: (mode: InferenceMode) => void
|
| 16 |
onUseTiling: (value: boolean) => void
|
| 17 |
onFilterOutliers: (value: boolean) => void
|
| 18 |
+
onShowConfidenceLabels: (value: boolean) => void
|
| 19 |
onRecluster: () => void
|
| 20 |
}
|
| 21 |
|
|
|
|
| 72 |
serverAvailable,
|
| 73 |
useTiling,
|
| 74 |
filterOutliers,
|
| 75 |
+
showConfidenceLabels,
|
| 76 |
onGroupCount,
|
| 77 |
onInferenceMode,
|
| 78 |
onUseTiling,
|
| 79 |
onFilterOutliers,
|
| 80 |
+
onShowConfidenceLabels,
|
| 81 |
onRecluster,
|
| 82 |
}: Props) {
|
| 83 |
return (
|
|
|
|
| 168 |
</div>
|
| 169 |
</section>
|
| 170 |
|
| 171 |
+
<section>
|
| 172 |
+
<p className="ct-section-label mb-2 px-1">{t(lang, 'debugSection')}</p>
|
| 173 |
+
<div className="ct-card overflow-hidden">
|
| 174 |
+
<Toggle
|
| 175 |
+
checked={showConfidenceLabels}
|
| 176 |
+
onChange={onShowConfidenceLabels}
|
| 177 |
+
label={t(lang, 'showConfidenceLabels')}
|
| 178 |
+
description={t(lang, 'showConfidenceLabelsHint')}
|
| 179 |
+
/>
|
| 180 |
+
</div>
|
| 181 |
+
</section>
|
| 182 |
+
|
| 183 |
<section>
|
| 184 |
<p className="ct-section-label mb-2 px-1">{t(lang, 'updateApp')}</p>
|
| 185 |
<div className="ct-card overflow-hidden p-3">
|
frontend/src/components/StepResults.tsx
CHANGED
|
@@ -12,6 +12,7 @@ interface Props {
|
|
| 12 |
detections: Detection[]
|
| 13 |
groups: DiameterGroup[]
|
| 14 |
counts: Record<number, number>
|
|
|
|
| 15 |
onUpdate: (dets: Detection[]) => void
|
| 16 |
onExpectedChange: (groupId: number, value: number | undefined) => void
|
| 17 |
onRecount: () => void
|
|
@@ -24,6 +25,7 @@ export function StepResults({
|
|
| 24 |
detections,
|
| 25 |
groups,
|
| 26 |
counts,
|
|
|
|
| 27 |
onUpdate,
|
| 28 |
onExpectedChange,
|
| 29 |
onRecount,
|
|
@@ -77,6 +79,7 @@ export function StepResults({
|
|
| 77 |
selectedGroupId={selectedGroupId}
|
| 78 |
animate
|
| 79 |
showCircleLabels={animDone}
|
|
|
|
| 80 |
displayBounds={animDone ? viewportSize : null}
|
| 81 |
onUpdate={onUpdate}
|
| 82 |
onCanvasReady={(c) => { canvasRef.current = c }}
|
|
|
|
| 12 |
detections: Detection[]
|
| 13 |
groups: DiameterGroup[]
|
| 14 |
counts: Record<number, number>
|
| 15 |
+
showConfidenceLabels: boolean
|
| 16 |
onUpdate: (dets: Detection[]) => void
|
| 17 |
onExpectedChange: (groupId: number, value: number | undefined) => void
|
| 18 |
onRecount: () => void
|
|
|
|
| 25 |
detections,
|
| 26 |
groups,
|
| 27 |
counts,
|
| 28 |
+
showConfidenceLabels,
|
| 29 |
onUpdate,
|
| 30 |
onExpectedChange,
|
| 31 |
onRecount,
|
|
|
|
| 79 |
selectedGroupId={selectedGroupId}
|
| 80 |
animate
|
| 81 |
showCircleLabels={animDone}
|
| 82 |
+
circleLabelMode={showConfidenceLabels ? 'confidence' : 'count'}
|
| 83 |
displayBounds={animDone ? viewportSize : null}
|
| 84 |
onUpdate={onUpdate}
|
| 85 |
onCanvasReady={(c) => { canvasRef.current = c }}
|
frontend/src/lib/debugSettings.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const STORAGE_KEY = 'pipecount-debug-confidence-labels'
|
| 2 |
+
|
| 3 |
+
export function loadShowConfidenceLabels(): boolean {
|
| 4 |
+
try {
|
| 5 |
+
return localStorage.getItem(STORAGE_KEY) === '1'
|
| 6 |
+
} catch {
|
| 7 |
+
return false
|
| 8 |
+
}
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
export function saveShowConfidenceLabels(enabled: boolean): void {
|
| 12 |
+
try {
|
| 13 |
+
localStorage.setItem(STORAGE_KEY, enabled ? '1' : '0')
|
| 14 |
+
} catch {
|
| 15 |
+
/* ignore */
|
| 16 |
+
}
|
| 17 |
+
}
|
frontend/src/lib/i18n.ts
CHANGED
|
@@ -68,6 +68,9 @@ const messages = {
|
|
| 68 |
apply: 'Apply',
|
| 69 |
updateApp: 'Update app',
|
| 70 |
updateAppHint: 'Reload the latest version from the server',
|
|
|
|
|
|
|
|
|
|
| 71 |
},
|
| 72 |
th: {
|
| 73 |
title: 'NPI นับท่อ',
|
|
@@ -136,6 +139,9 @@ const messages = {
|
|
| 136 |
apply: 'ใช้',
|
| 137 |
updateApp: 'อัปเดตแอป',
|
| 138 |
updateAppHint: 'โหลดเวอร์ชันล่าสุดจากเซิร์ฟเวอร์',
|
|
|
|
|
|
|
|
|
|
| 139 |
},
|
| 140 |
} as const
|
| 141 |
|
|
|
|
| 68 |
apply: 'Apply',
|
| 69 |
updateApp: 'Update app',
|
| 70 |
updateAppHint: 'Reload the latest version from the server',
|
| 71 |
+
debugSection: 'Debug',
|
| 72 |
+
showConfidenceLabels: 'Show confidence scores',
|
| 73 |
+
showConfidenceLabelsHint: 'Display model confidence in circles instead of count numbers',
|
| 74 |
},
|
| 75 |
th: {
|
| 76 |
title: 'NPI นับท่อ',
|
|
|
|
| 139 |
apply: 'ใช้',
|
| 140 |
updateApp: 'อัปเดตแอป',
|
| 141 |
updateAppHint: 'โหลดเวอร์ชันล่าสุดจากเซิร์ฟเวอร์',
|
| 142 |
+
debugSection: 'ดีบัก',
|
| 143 |
+
showConfidenceLabels: 'แสดงค่า confidence',
|
| 144 |
+
showConfidenceLabelsHint: 'แสดงความมั่นใจของโมเดลในวงกลม แทนหมายเลขนับ',
|
| 145 |
},
|
| 146 |
} as const
|
| 147 |
|
frontend/src/lib/types.ts
CHANGED
|
@@ -26,6 +26,9 @@ export type Lang = 'en' | 'th'
|
|
| 26 |
/** Where pipe detection runs: server (default) or in-browser ONNX. */
|
| 27 |
export type InferenceMode = 'server' | 'local'
|
| 28 |
|
|
|
|
|
|
|
|
|
|
| 29 |
export interface LetterboxMeta {
|
| 30 |
scale: number
|
| 31 |
padX: number
|
|
|
|
| 26 |
/** Where pipe detection runs: server (default) or in-browser ONNX. */
|
| 27 |
export type InferenceMode = 'server' | 'local'
|
| 28 |
|
| 29 |
+
/** Circle label content on the results canvas. */
|
| 30 |
+
export type CircleLabelMode = 'count' | 'confidence'
|
| 31 |
+
|
| 32 |
export interface LetterboxMeta {
|
| 33 |
scale: number
|
| 34 |
padX: number
|