Added fallback for ML grid detection to use raw prediction

This commit is contained in:
Mitchell McCaffrey 2020-10-17 21:52:41 +11:00
parent bd05595efe
commit 6cb594216e

View File

@ -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 };