isl-org / OpenBot

OpenBot leverages smartphones as brains for low-cost robots. We have designed a small electric vehicle that costs about $50 and serves as a robot body. Our software stack for Android smartphones supports advanced robotics workloads such as person following and real-time autonomous navigation.
https://www.openbot.org
MIT License
2.81k stars 526 forks source link

Is there already an existing .java file for using YOLOv7 tiny in OpenBot? #335

Closed RoBoFAU closed 1 year ago

RoBoFAU commented 1 year ago

Do you have any idea which parameter/function I have to change to deploy custom YOLOv7 tiny with the OpenBot?

Any idea is helpfull! :-)

quentin-leboutet commented 1 year ago

Hello RoBoFAU,

Seems like a nice project! I'm not so familiar with YoloV7 but I think you may need to implement an extension of the detector class, for instance in a dedicated DetectorYoloV7.java file. You could use DetectorYoloV4.java or DetectorYoloV5.java as templates to be fine-tuned to the input/output shape of your data. You should also let the system be aware about your detector's .tflite file (I here assume you are using tensorflow lite) by adding the suitable fields in your config.json file (you can use the previous entries in this file as a template). Also don't forget to add a "YOLOV7" field in the model enums as well as in the Detector switch.

Doing so should bring you pretty close to a working solution. Let us know if you face any issue.

RoBoFAU commented 1 year ago

Hello!

Thanks for your answer! I already did exactly what you wrote but it is not working. I copied the DetectorYolov5 file and tried to apply it to Yolov7 tiny. Also added the tflite file to assets/networks, config.json and the model enums and Detector switch. I am really new to object detection/yolo topic, that's why it is hard for me to fine-tune input/output parameters that are required from the OpenBot App.

RoBoFAU commented 1 year ago

Could you maybe help me by telling which parameters are typically the ones to change/adjust?

thias15 commented 1 year ago

Hi @RoBoFAU. One important factor is the input and output dimension. You can load your tflite file using netron to find out.

RoBoFAU commented 1 year ago

Hi @RoBoFAU. One important factor is the input and output dimension. You can load your tflite file using netron to find out.

yolov7tiny.tflite: input_output_yolov7tiny

in comparison to yolov5s.tflite: input_output_yolov5s

thias15 commented 1 year ago

Ok, so the input name has to be changed and also the image tensor is in a different format. You would also need to figure out how to parse the output since it's a different format.