mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Object detection OOM crash (#1451)
Don't return before we release the object.
This commit is contained in:
@@ -112,15 +112,18 @@ public class RknnObjectDetector implements ObjectDetector {
|
||||
Letterbox scale =
|
||||
Letterbox.letterbox(in, letterboxed, this.inputSize, ColorHelper.colorToScalar(Color.GRAY));
|
||||
if (!letterboxed.size().equals(this.inputSize)) {
|
||||
letterboxed.release();
|
||||
throw new RuntimeException("Letterboxed frame is not the right size!");
|
||||
}
|
||||
|
||||
// Detect objects in the letterboxed frame
|
||||
var results = RknnJNI.detect(objPointer, letterboxed.getNativeObjAddr(), nmsThresh, boxThresh);
|
||||
|
||||
letterboxed.release();
|
||||
|
||||
if (results == null) {
|
||||
return List.of();
|
||||
}
|
||||
letterboxed.release();
|
||||
|
||||
return scale.resizeDetections(
|
||||
List.of(results).stream()
|
||||
|
||||
Reference in New Issue
Block a user