Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IndexOutOfBoundsException: Index 80 out of bounds for length 80 #83

Open
ZherriDev opened this issue Dec 18, 2024 · 2 comments
Labels
bug Something isn't working classify Image Classification issues, PR's

Comments

@ZherriDev
Copy link

I tried to implement image classification, but it gives me this whole java error. I tried to implement object detection and worked well, but image classification isn't working. Is there any way I can fix this?

D/AndroidRuntime( 7585): Shutting down VM
E/AndroidRuntime( 7585): FATAL EXCEPTION: main
E/AndroidRuntime( 7585): Process: com.example.example, PID: 7585
E/AndroidRuntime( 7585): java.lang.IndexOutOfBoundsException: Index 80 out of bounds for length 80
E/AndroidRuntime( 7585): at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
E/AndroidRuntime( 7585): at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
E/AndroidRuntime( 7585): at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
E/AndroidRuntime( 7585): at java.util.Objects.checkIndex(Objects.java:359)
E/AndroidRuntime( 7585): at java.util.ArrayList.get(ArrayList.java:434)
E/AndroidRuntime( 7585): at com.ultralytics.ultralytics_yolo.predict.classify.TfliteClassifier.runInference(TfliteClassifier.java:245)
E/AndroidRuntime( 7585): at com.ultralytics.ultralytics_yolo.predict.classify.TfliteClassifier.lambda$predict$0$com-ultralytics-ultralytics_yolo-predict-classify-TfliteClassifier(TfliteClassifier.java:179)
E/AndroidRuntime( 7585): at com.ultralytics.ultralytics_yolo.predict.classify.TfliteClassifier$$ExternalSyntheticLambda2.run(Unknown Source:2)
E/AndroidRuntime( 7585): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime( 7585): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 7585): at android.os.Looper.loopOnce(Looper.java:210)
E/AndroidRuntime( 7585): at android.os.Looper.loop(Looper.java:299)
E/AndroidRuntime( 7585): at android.app.ActivityThread.main(ActivityThread.java:8319)
E/AndroidRuntime( 7585): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7585): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
E/AndroidRuntime( 7585): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)
W/example.example( 7585): type=1400 audit(0.0:37540): avc: denied { search } for name="mqsas" dev="sda18" ino=475 scontext=u:r:untrusted_app:s0:c125,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.example.example
W/example.example( 7585): type=1400 audit(0.0:37541): avc: denied { search } for name="mqsas" dev="sda18" ino=475 scontext=u:r:untrusted_app:s0:c125,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.example.example
W/example.example( 7585): type=1400 audit(0.0:37542): avc: denied { search } for name="mqsas" dev="sda18" ino=475 scontext=u:r:untrusted_app:s0:c125,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.example.example
W/example.example( 7585): type=1400 audit(0.0:37543): avc: denied { search } for name="mqsas" dev="sda18" ino=475 scontext=u:r:untrusted_app:s0:c125,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.example.example
W/example.example( 7585): type=1400 audit(0.0:37544): avc: denied { getattr } for path="/data/mqsas" dev="sda18" ino=475 scontext=u:r:untrusted_app:s0:c125,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.example.example
W/example.example( 7585): type=1400 audit(0.0:37545): avc: denied { search } for name="mqsas" dev="sda18" ino=475 scontext=u:r:untrusted_app:s0:c125,c258,c512,c768 tcontext=u:object_r:mqsas_data_file:s0 tclass=dir permissive=0 app=com.example.example
I/Process ( 7585): Sending signal. PID: 7585 SIG: 9
Lost connection to device.

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working classify Image Classification issues, PR's labels Dec 18, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @ZherriDev, thank you for submitting a ultralytics/yolo-flutter-app 🚀 Issue. To help us address your concern efficiently, please ensure you've provided the following details:

  1. For bug reports:

    • A clear and concise description of the bug
    • A minimum reproducible example (MRE) [https://docs.ultralytics.com/help/minimum_reproducible_example/] that demonstrates the issue
    • Your environment details (e.g., Flutter version, mobile OS version, device model)
    • Expected behavior vs. actual behavior
    • Any complete error logs or stack traces (thank you for already including the error logs!)
  2. For feature requests:

    • A clear and concise description of the proposed feature
    • The problem this feature would solve
    • Any alternative solutions you've considered
  3. For questions:

    • Provide as much context as possible about your question
    • Include any research you've already done on the topic
    • Specify which parts of the documentation, if any, you've already consulted

In your provided error trace, it seems to be related to the TfliteClassifier during image classification. If you haven't already, please ensure you've set up the correct input parameters and model for classification, as it might differ from object detection.

Lastly, if you haven't already, kindly verify that you've searched existing issues to avoid possible duplicates. An Ultralytics engineer will review your issue and provide further assistance soon. 🚀 Debugging together makes us stronger!

Thank you for contributing to improving the yolo-flutter-app project ❤️

@pderrenger
Copy link
Member

The error suggests an IndexOutOfBoundsException in the TFLite classifier during image classification. This may occur if the model's output classes or label mapping doesn't align with the input data or the model configuration.

To resolve this:

  1. Verify that the model used for classification is correctly exported for its intended task (image classification).
  2. Ensure the correct number of classes is specified in the model's configuration and matches the labels file.
  3. If you're using a custom model, double-check the preprocessing pipeline and ensure compatibility with the classification task.

If the issue persists, please try with the latest version of the Ultralytics package and ensure all dependencies are up to date. For more guidance, refer to the Ultralytics Docs or share additional details about your setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working classify Image Classification issues, PR's
Projects
None yet
Development

No branches or pull requests

3 participants