jaroslawkrol / vision-camera-realtime-object-detection

VisionCamera Frame Processor Plugin to detect objects using TensorFlow Lite Task Vision
MIT License
102 stars 12 forks source link

undefined value #7

Closed shahinyan11 closed 1 year ago

shahinyan11 commented 1 year ago

Below you can see a part of my code where the call detectObjects(frame, frameProcessorConfig) always returns undefined

Screenshot 2023-08-21 at 16 10 35

I also looked at the logs in Android Studio and found this

Screenshot 2023-08-21 at 16 15 30

Is there someone, who familiar with this error and managed to use the package without mentioned error ?

hirendudhat03 commented 1 year ago

@shahinyan11 your model include metadata? because I have same issue because my model not including metadata.

Noahkoole commented 1 year ago

Have you been able to fix this issue?

arpkirill commented 1 year ago

Have you been able to fix this issue?

no

Noahkoole commented 1 year ago

@arpkirill Your logs in android studio explains the issue. You have 2 different kinds of tflite models. 1 with metadata including labels and stuff and 1 without. you can only use the tflite with metadata. if you take an example model from tflite website it works fine. I assume it uses MLKit or something underneath because MLKit also only works with metadata.

arpkirill commented 1 year ago

@arpkirill Your logs in android studio explains the issue. You have 2 different kinds of tflite models. 1 with metadata including labels and stuff and 1 without. you can only use the tflite with metadata. if you take an example model from tflite website it works fine. I assume it uses MLKit or something underneath because MLKit also only works with metadata.

Tell me a fully working tflite file so that I can test

arpkirill commented 1 year ago

@arpkirill Your logs in android studio explains the issue. You have 2 different kinds of tflite models. 1 with metadata including labels and stuff and 1 without. you can only use the tflite with metadata. if you take an example model from tflite website it works fine. I assume it uses MLKit or something underneath because MLKit also only works with metadata.

https://github.com/arpkirill/test-camera-object-detector

this is my demo project, which has a problem, I will be glad to hear your comments

jejolare commented 1 year ago

I have the same issue, tried several models. Btw, @arpkirill, your repository is private, we can't open

jejolare commented 1 year ago

@Noahkoole , could you provide any example of fully working model please 🙏?

arpkirill commented 1 year ago

I have the same issue, tried several models. Btw, @arpkirill, your repository is private, we can't open

I made it public, the only thing is to manually give permission to the phone camera

arpkirill commented 1 year ago

I have the same issue, tried several models. Btw, @arpkirill, your repository is private, we can't open

do you have any idea how to run it?

jejolare commented 1 year ago

arpkirill

idk, I can't run even their example. I have same issue, and have no idea what to do. I don't think that developer will help us soon: image

jejolare commented 1 year ago

or maybe someone could provide us with working tflite

arpkirill commented 1 year ago

arpkirill

idk, I can't run even their example. I have same issue, and have no idea what to do. I don't think that developer will help us soon: image

In the demo project, you need to update the dependencies in Gradle, I don't remember which ones exactly. Did you launch my project?

jaroslawkrol commented 1 year ago

@arpkirill @jejolare As @Noahkoole and @hirendudhat03 mentioned above your model has to contains metadata. Remember about it if you wants to create your own TFLite model. It's not my library's requirement, it's just a TensorFlow Lite Vision requirement used in the background.

If you want to test your code with existing correct model, just use TFHub as I mentioned in docs. To do it:

  1. Go to TFHub.dev
  2. In filters select Problem domains > Images > Object Detection image
  3. Find one of models matched to your preferences and contains metadata included f.e. ssd_mobilenet_v1 image
  4. In section Model formats click on tab with (metadata) if there is more than one format image
  5. Download it!

Sorry guys, for so late response but as I mentioned in one of the threads my current project and private life consumes me totally. I also have my doubts that it still makes sense to maintain the library, because the new version of Vision Camera is going to bring big changes and possibility to use TFLite models just by drag & drop. But I need to talk with Marc about it to be sure, what is the current direction of Vision Camera library.

@arpkirill Please, test your code with this model: https://tfhub.dev/tensorflow/lite-model/ssd_mobilenet_v1/1/metadata/2 and let me know about results, to know i can close this ticket. If not, we will try to resolve it together.

arpkirill commented 1 year ago

@arpkirill @jejolare As @Noahkoole and @hirendudhat03 mentioned above your model has to contains metadata. Remember about it if you wants to create your own TFLite model. It's not my library's requirement, it's just a TensorFlow Lite Vision requirement used in the background.

If you want to test your code on existing correct one, just use TFHub as I mentioned in docs. To do it:

  1. Go to TFHub.dev
  2. In filters select Problem domains > Images > Object Detection image
  3. Find one of models matched to your preferences and contains metadata included f.e. ssd_mobilenet_v1 image
  4. In section Model formats click on tab with (metadata) if there is more than one format image
  5. Download it!

Sorry guys, for so late response but as I mentioned in one of the threads my current project and private life consumes me totally. I also have my doubts that it still makes sense to maintain the library, because the new version of Vision Camera is going to bring big changes and possibility to use TFLite models just by drag & drop. But I need to talk with Marc about it to be sure, what is the current direction of Vision Camera library.

@arpkirill Please, test your code with this model: https://tfhub.dev/tensorflow/lite-model/ssd_mobilenet_v1/1/metadata/2 and let me know about results, to know i can close this ticket. If not, we will try to resolve it together.

IMG_20230829_015242_143.jpg

IMG_20230829_015245_828.jpg

Everything works fine with this model, thank you very much for your help! I saw version 3, it looks cool, but as I understand it, it is still in the beta version.

jaroslawkrol commented 1 year ago

@arpkirill Thanks for quick reply! BTW. the prettiest cat i've ever seen 🤣

ElicaInc commented 8 months ago

Super! Great tutorial!