You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for providing the facility to use custom trained networks in onnx format with your Deep Vision library for Processing (V4, windows 10 and 11).
I've trained a custom detector in VS code using YoloV5n and exported it to onnx format, along with a file describing the labels (there is only a single class to be detected).
Unfortunately when I try to run detections on a single image I get the error below:
java.lang.NullPointerException: Cannot invoke "org.bytedeco.opencv.opencv_dnn.Net.setInput(org.bytedeco.opencv.opencv_core.Mat)" because "this.net" is null
at ch.bildspur.vision.YOLONetwork.run(YOLONetwork.java:81)
at ch.bildspur.vision.YOLONetwork.run(YOLONetwork.java:20)
at ch.bildspur.vision.network.BaseNeuralNetwork.run(BaseNeuralNetwork.java:21)
at YOLOv5.setup(YOLOv5.java:99)
at processing.core.PApplet.handleDraw(PApplet.java:2051)
at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1386)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)
Hi
I thought it might be an issue setting the path to the model and labels. The labels and onnx file are both contained in the sketch's data folder The paths are shown below (some private info removed):
below is the setup part of the processing sketch if that is any help:
network = new YOLONetwork(
null, // for yolov5 the weights already contains the model in onnx format
pm, // trained weights of the model
640, 640, // inference size
false
);
network.loadLabels(pl);
network.setConfidenceThreshold(0.5f);
//network.setTopK(100);
//if (network == null)
if (loadimage == null)
println("it is null");
do
{
Thread.yield();
println("waiting ...");
}
while (network == null);
// note - waiting is only printing once, suggesting that the network was created in the constructor
try{
detections = network.run(loadimage);
}catch(NullPointerException e){e.printStackTrace();}
println("Hi");
}
// note the error I mentioned before is displayed from the stacktrace
Many thanks for any suggestions you can provide. I am happy to PM the complete sketch code to you.
Sincerely,
Zeffman
The text was updated successfully, but these errors were encountered:
Dear cansik,
Thank you for providing the facility to use custom trained networks in onnx format with your Deep Vision library for Processing (V4, windows 10 and 11).
I've trained a custom detector in VS code using YoloV5n and exported it to onnx format, along with a file describing the labels (there is only a single class to be detected).
Unfortunately when I try to run detections on a single image I get the error below:
java.lang.NullPointerException: Cannot invoke "org.bytedeco.opencv.opencv_dnn.Net.setInput(org.bytedeco.opencv.opencv_core.Mat)" because "this.net" is null
at ch.bildspur.vision.YOLONetwork.run(YOLONetwork.java:81)
at ch.bildspur.vision.YOLONetwork.run(YOLONetwork.java:20)
at ch.bildspur.vision.network.BaseNeuralNetwork.run(BaseNeuralNetwork.java:21)
at YOLOv5.setup(YOLOv5.java:99)
at processing.core.PApplet.handleDraw(PApplet.java:2051)
at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1386)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)
Hi
I thought it might be an issue setting the path to the model and labels. The labels and onnx file are both contained in the sketch's data folder The paths are shown below (some private info removed):
pl: C:\Users\xxxj\xxx\xxx\xxx\src\proc4sketches\YOLOv5\data\classes.txt
pm: C:\Users\jxxxj\xxx\xxx\xxx\src\proc4sketches\YOLOv5\data\best.onnx
below is the setup part of the processing sketch if that is any help:
network = new YOLONetwork(
null, // for yolov5 the weights already contains the model in onnx format
pm, // trained weights of the model
640, 640, // inference size
false
);
network.loadLabels(pl);
network.setConfidenceThreshold(0.5f);
//network.setTopK(100);
//if (network == null)
if (loadimage == null)
println("it is null");
do
{
Thread.yield();
println("waiting ...");
}
while (network == null);
// note - waiting is only printing once, suggesting that the network was created in the constructor
try{
detections = network.run(loadimage);
}catch(NullPointerException e){e.printStackTrace();}
println("Hi");
}
// note the error I mentioned before is displayed from the stacktrace
Many thanks for any suggestions you can provide. I am happy to PM the complete sketch code to you.
Sincerely,
Zeffman
The text was updated successfully, but these errors were encountered: