Preload OD models before import to check quantization (#2056)

Co-authored-by: samfreund <samf.236@proton.me>
Co-authored-by: Sam Freund <techguy763@gmail.com>
This commit is contained in:
Rikhil Chilka
2025-08-16 01:59:22 -04:00
committed by GitHub
parent 2ab7a2e389
commit 2eb224a55f
4 changed files with 49 additions and 11 deletions

View File

@@ -74,6 +74,8 @@ public class RknnObjectDetector implements ObjectDetector {
if (objPointer <= 0) {
throw new RuntimeException(
"Failed to create detector from path " + model.modelFile.getPath());
} else if (!RknnJNI.isQuantized(objPointer)) {
throw new UnsupportedOperationException("Model must be quantized.");
}
logger.debug("Created detector for model " + model.modelFile.getName());

View File

@@ -80,6 +80,8 @@ public class RubikObjectDetector implements ObjectDetector {
+ ". Please ensure the model is valid and compatible with the Rubik backend.");
throw new RuntimeException(
"Failed to create detector from path " + model.modelFile.getPath());
} else if (!RubikJNI.isQuantized(ptr)) {
throw new UnsupportedOperationException("Model must be quantized.");
}
logger.debug("Created detector for model " + model.modelFile.getName());