-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Invalid output Tensor index: 1 when trying to run a tiny-yolov3 model on TFLite #39803
Comments
@SirTapir Happy that you re-opened the issue really hope that someone can help |
@SirTapir still having the same problem ? |
@Anasel23 Yes, no progress yet |
@SirTapir do you think that it can be a problem in the architecture of the model itself? I mean the tiny version has been created so it can be used on mobiles can we change it architecture by removing some layers and do another training |
@Anasel23 I'll be honest, I have no idea. I've been facing this error for weeks now, not really sure where the problem lies. |
@SirTapir facing the same problem too for weeks now. You must know that i've followed the exact same process !!Hope to find the solution. |
@jvishnuvardhan |
@SirTapir Any updates on this error ? did you train your yolov3_tiny_obj with this weights that you installed using this command |
@Anasel23 Yes, I trained the model with the same command. Btw, I've also opened a question at stack overflow here maybe it could be of some help.
There are 2535 array with differing values, I only provided 10 of them as an example. Here's my latest TFLiteObjectDetectionAPIModel.java if needed @jvishnuvardhan |
Alright, I got it now. Why the array is shaped [1][2535][7] YOLO v3 makes prediction across 3 different scales. The detection layer is used make detection at feature maps of three different sizes, having strides 32, 16, 8 respectively. This means, with an input of 416 x 416, we make detections on scales Tiny Version of Yolov3 apparently only use 2 size, strides 32 and 16 only. This means, with an input of 416 x 416, it makes detection on scales The shape [1][2535][7] is created because mystic's implementation concatenate the results of (13x13) detection and (26x26). So, we got 2353 from The [7] last array is the bounding boxes, confidences, and probability of that class being there. Trying to convert said array into a working detector is a challenge. But at least I understand where to begin. Resource: |
Do you extract the bounding box information like this? I'm getting weird results after doing this. Here is my complete code...All the bounding boxes in my frame are stacked on top left, and there is only one class title showing for all the bounding boxes. Here is the full code
|
@agh372 Ah, I didn't continue with mystic's converter. I've changed my converter to hunlgc007's converter at https://github.com/hunglc007/tensorflow-yolov4-tflite and used the android example in their repo as a reference to implement yolov3 to work in mobile app. |
@SirTapir Do we need anchors and masks? But that is YoloClassifier4 right? Is there any difference between their implementation. |
@agh372 It's been a while, but IIRC yes. We still need anchors and masks. In that repo you could also convert yolov3 models. You just need to put yolov3's mask and anchor values |
Sorry to bother, but I have been struggling to get the bounding boxes. I have a yolov3-tiny.tflite model Could you tell me the name of the function you used..There are many functions commented in this class |
@agh372 I used most of them, just change the mask and achors value so that it matches with yolov3 and you should be good to go. |
Thank you! Last question, so anchors and masks are fixed for all yolov3-tiny models right (irrespective of the shape) right? |
@agh372 AFAIK yes. But don't quote me on that. I haven't refreshed my memory on YOLOv3 |
Thank you so much! @SirTapir |
@SirTapir |
@agh372 Sorry, I don't know where the problem is that could result in your picture. Maybe try opening an issue in that repo? |
@SirTapir I figured the post-processing part! I have a question regarding the order. So I observed that your tflite model has a shape of [1, 2535, 7] What I don't understand is, so each grid cell of 13 scales are used to predict 3 bounding box is what I read. Hence the formula ( B * ( C + 5)). Here B = 3 in my case. So in the array of 2535, If the 0th index represents the first cell (0,0) of 13 scale for the first bounding box what does the 1st index represent then? Does it represent the second bounding box information for the first cell (0,0) of 13 scale or Does it represent the first bounding box information for the second cell (0,1) of 13 scale? |
Following @jvishnuvardhan suggestion in #39157 (comment)_, I'm creating a new issue
I'm facing an error when trying to run a tiny-yolov3 model on TensorFlow Lite's Object Detection Android Demo.
When I try to run the app on mobile phone, the app crashed with the following error
I'm using yolov3-tiny that was trained (using transfer learning) with Alexey's implementation to detect 2 custom objects (knife and machete).
mystic's implementation was then used to convert the .weight file to a .pb
Then I used the following code to convert the .pb file to .tflite
(I'm using tensorflow 1.15 to run this code)
The .tflite that was created is then moved to the assets folder of the object_detection example of tflite https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android
The tflite and labelfile that I used can be found here https://drive.google.com/file/d/1Av7Q1mjLdOIEE81oNnt8cLENlXykxnEu/view?usp=sharing
I changed the following on DetectorActivity.java
Then I changed the following on TFLiteObjectDetectionAPIModel.java
Here's the DetectorActivity.java and TFLiteObjectDetectionAPIModel.java that I use here
Any assistance would be appreciated
The text was updated successfully, but these errors were encountered: