Open peacefulhill opened 1 month ago
Just after finally writing an issue, I noticed the mentioning of "labelsStartFromZero: true", but I can't seem to find where to put it, my best guess is within the doods.detectors as it must be model specific, but e.g. this config does not fix my issue above:
- name: coral_lite3
type: tflite
modelFile: /share/doods/models/efficientdet_lite3_512_ptq_edgetpu.tflite
labelFile: /share/doods/models/coco_labels.txt
labelsStartFromZero: true
hwAccel: true
Edit: I have studied the code and from what I can tell, the example config above really should work, but I can't get the config to take and use 0 indexing for the labels. FWIW I am running the doods2 as an HAOS addon. It is actually working really well apart from the 0 vs 1 indexing issue I have. Also the hwAccel boolean works very similar to the labelsStartFromZero and I don't have any issues with the hwAccel setting, it works fine (after adding privileged: true to the server config).
Ok, so I found a difference in how the default label file is constructed and the ones you download from coral.ai. The default labels include index numbers, e.g. 0 person 1 bicycle 2 car
If I add such index number to the label files for the EdgeTPU models, it does work. However I still consider the labelsStartFromZero: true not to be working as intended. If I have misunderstood the indended use of this variable, fell free to close the issue. It would be really nice if the labels that you download from coral.ai for the EdgeTPU would just work, but adding index numbers is of course fairly straight forward as a workaround.
Yeah, you have labelsStartFromZero
in the right place. I just reviewed all the code and it looks right. Are you sure you didn't have the number in the file when you tried it?
Yes, I am sure as at that testing stage I had not yet understood adding index was possible. I instead temporarily worked around the issue by removing the first row. I couldn’t find any obvious issues in the code either. It should be possible to reproduce with cora.ai downloadable models. However I will not push for further investigation as I am happy with just adding index. Thanks for confirming I was using ghe variable correctly.
Tested more or less all coral.ai EdgeTPU models, which all shares the same label file. I have the same problem with all models. The labels are off by one, and the first label is considered "unknown" which is supposed to be "person". Example, beginning of labels: person bicycle car In the detection, bicycles becomes person, cars become bicycles and persons become unknown. This problem does not appear for tflite models (not EdgeTPU version)
It can be sort of worked around assuming you don't care about detecting persons. If the first row with person is deleted. It all works, persons still become unknown but all other labels work.
Example, with all labels in the file:![image](https://github.com/snowzach/doods2/assets/7250474/8bd990f8-b678-4aa4-95c9-81e9b5d495a3)
Example, with person removed from label file:![image](https://github.com/snowzach/doods2/assets/7250474/3132ccb5-cb43-4fc3-8ee0-31f8781c517a)
And finally the default tflite (not for EdgeTPU, person at the beginning of label also here):![image](https://github.com/snowzach/doods2/assets/7250474/e5b9ac4a-05a1-4f1a-ad15-868051942101)