Code Monkey home page Code Monkey logo

Comments (14)

szaza avatar szaza commented on August 11, 2024

It seems the tensorFlowOutput array doesn't have the element which you want to access. Could you please put a brakepoint in the line 82 of the YOLOClassifier and check the size of the tensorFlowOutput array?
Does your retrained modell recognize your classes with darkFlow or darkNet?

from android-yolo-v2.

mking1011 avatar mking1011 commented on August 11, 2024

Hi @szaza

Of course, when I tested in darknet and darkflow, the re-trained pb file was successful.
The size of the tensorFlowOutput array is 3549

Do you have any problems ?

from android-yolo-v2.

szaza avatar szaza commented on August 11, 2024

No, I did not have similar problems so far.
How many classes do you have?

from android-yolo-v2.

mking1011 avatar mking1011 commented on August 11, 2024

@szaza

I have two classes

from android-yolo-v2.

mking1011 avatar mking1011 commented on August 11, 2024

five_fist_20000_yoloGraph.zip

Is there a problem with my pb file?

from android-yolo-v2.

szaza avatar szaza commented on August 11, 2024

Unfortunately, I did not have time to check your file, I'm just thinking what could be the problem.
I don't think so that you have problems with your protobuff file.
Did you use the tiny-yolo model from the https://pjreddie.com/darknet/yolov2/, which requires a 416X416x3 long input?

from android-yolo-v2.

mking1011 avatar mking1011 commented on August 11, 2024

@szaza
I modified the tiny-yolo model to 270X360X3

from android-yolo-v2.

szaza avatar szaza commented on August 11, 2024

Ok, then the INPUT_SIZE should be modified in the Config.java. The size of the standard tiny-yolo-v2 is 416x416x3, so please create an INPUT_WIDTH and INPUT_HEIGHT constant in the Config.java and change every places in the code where the INPUT_SIZE is used: e.g. here;

from android-yolo-v2.

mking1011 avatar mking1011 commented on August 11, 2024

I received your opinion, but the result was the same error.

from android-yolo-v2.

szaza avatar szaza commented on August 11, 2024

Could you check the size of the tensorFlowOutput after these changes?
You can also try to decrease the number of the cells, by modifying the SIZE in the YOLOClassifier.java.
By default the tiny-yolo-v2 uses 13x13 cells and the size of the tensorflow output should be 13x13x5x(NR_OF_CLASSES + 5);

from android-yolo-v2.

mking1011 avatar mking1011 commented on August 11, 2024

@szaza

The length of tensorFlowOutput was still 3549.

I created the weight file by referring to the site below.
https://github.com/unsky/yolo-for-windows-v2

I also created a pb file by referring to the following site
https://github.com/thtrieu/darkflow

Is there a problem with my pb file?
When testing with the webcam, the results were successful.
But I do not know why it does not work on Android phones.
And when I create a pb file using darkflow, does the Tensorflow version work?

Here is the error that appears after changing INPUT_SIZE
I would be so grateful if you give me some advice

E/AndroidRuntime: FATAL EXCEPTION: inference
Process: org.tensorflow.yolo, PID: 7539
java.lang.ArrayIndexOutOfBoundsException: length=3549; index=3549
at org.tensorflow.yolo.YOLOClassifier.getModel(YOLOClassifier.java:88)
at org.tensorflow.yolo.YOLOClassifier.classifyImage(YOLOClassifier.java:71)
at org.tensorflow.yolo.TensorFlowImageRecognizer.recognizeImage(TensorFlowImageRecognizer.java:52)
at org.tensorflow.yolo.view.ClassifierActivity.lambda$onImageAvailable$1$ClassifierActivity(ClassifierActivity.java:109)
at org.tensorflow.yolo.view.ClassifierActivity$$Lambda$1.run(Unknown Source:0)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)

from android-yolo-v2.

szaza avatar szaza commented on August 11, 2024

This implementation works with the standard parameters of the YoloV2, so in case if you change it's parameters, you have to change the parameters inside the implementation as well.
Here you can find a description about how I trained my models: https://sites.google.com/view/tensorflow-example-java-api/complete-guide-to-train-yolo;

from android-yolo-v2.

mking1011 avatar mking1011 commented on August 11, 2024

@szaza
I finally succeeded.
Thank you for your help.
I wish you all good

from android-yolo-v2.

szaza avatar szaza commented on August 11, 2024

I'm glad to hear from you that you managed to solve the problem. I wish all the best for your project!

from android-yolo-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.