Replies: 2 comments
-
@momentNi Where is your yolov3 model comes from? The YoloTranslator matches GluonCV yolov3 implementation. You might need to create your own translator if the model trained with other engine. |
Beta Was this translation helpful? Give feedback.
-
In Yolo (and other object detection models), the output of the model should be some number of bounding box locations and probabilities that each location contains a particular class. However, this data must be represented using only NDArrays and there isn't just one way that it is possible to represent it. It is possible that your model is using some slightly different representation of the output data then the one that this implementation of You should try to look into your model's output and especially it's output types and see if you can figure out how it represents the data. Then, you can use the |
Beta Was this translation helpful? Give feedback.
-
When I use DJL ai.djl.modality.cv.translator.YoloTranslator to load a YOLO-V3 model and predict a picture, the program throws an Exception:
Exception in thread "main" ai.djl.translate.TranslateException: java.lang.IndexOutOfBoundsException: Index 25 out of bounds for length 1
at ai.djl.inference.Predictor.batchPredict(Predictor.java:186)
at ai.djl.inference.Predictor.predict(Predictor.java:123)
at modelTest.main(modelTest.java:99)
Caused by: java.lang.IndexOutOfBoundsException: Index 25 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:459)
at ai.djl.modality.cv.translator.YoloTranslator.processOutput(YoloTranslator.java:63)
at ai.djl.modality.cv.translator.YoloTranslator.processOutput(YoloTranslator.java:27)
at ai.djl.inference.Predictor.processOutputs(Predictor.java:222)
at ai.djl.inference.Predictor.batchPredict(Predictor.java:180)
... 2 more
Enviroment: DJL 0.14.0 PyTorch 1.9.1 JDK11 IntelliJ IDEA Ultimate 2021.2.3
Here's the code to load and use the model:
The model can run by using Python, so the model itself has no mistakes. The model's input image size is [640*640]. I use similar code to run a YOLO-V5 model, and there is no problem.
When I debug the program, it seems that the problem occurs at the following position:
YoloTranslator.java
If anyone can point out the mistakes in my code, I would be very grateful!!!
Beta Was this translation helpful? Give feedback.
All reactions