Added fallback for ML grid detection to use raw prediction
This commit is contained in:
parent
bd05595efe
commit
6cb594216e
@ -113,8 +113,16 @@ async function gridSizeML(image, candidates) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const x = Math.floor(width / bestScale);
|
let x = Math.floor(width / bestScale);
|
||||||
const y = Math.floor(height / bestScale);
|
let y = Math.floor(height / bestScale);
|
||||||
|
|
||||||
|
if (gridSizeVaild(x, y)) {
|
||||||
|
return { x, y };
|
||||||
|
} else {
|
||||||
|
// Fallback to raw prediction
|
||||||
|
x = Math.round(prediction);
|
||||||
|
y = Math.floor(x / ratio);
|
||||||
|
}
|
||||||
|
|
||||||
if (gridSizeVaild(x, y)) {
|
if (gridSizeVaild(x, y)) {
|
||||||
return { x, y };
|
return { x, y };
|
||||||
|
Loading…
Reference in New Issue
Block a user