pipecountapp-dev / frontend /src /lib /modelSelect.ts
Khunndev
Cursor
Improve detection accuracy with tiling defaults, 1024 model, and tuned thresholds.
2b21a73
Raw History Blame Contribute Delete
502 Bytes
import {
INFERENCE_SIZE,
INFERENCE_SIZE_SMALL,
MODEL_640_URL,
MODEL_URL,
} from './constants'
export function selectModelForImage(width: number, height: number): {
modelUrl: string
inferenceSize: number
} {
const maxDim = Math.max(width, height)
// Prefer 1024 for pipe-end detail; 640 only for very small previews.
if (maxDim <= 900) {
return { modelUrl: MODEL_640_URL, inferenceSize: INFERENCE_SIZE_SMALL }
}
return { modelUrl: MODEL_URL, inferenceSize: INFERENCE_SIZE }
}