abdelaziz-mahdy / pytorch_lite

flutter package to help run pytorch lite models classification and YoloV5 and YoloV8.
MIT License
49 stars 18 forks source link

Pytorch detection values #31

Closed knightebsuku closed 11 months ago

knightebsuku commented 11 months ago

Hi There

I created a custom object detection model using yolov5 and I'm trying to implement it into my mobile project

I'm getting strange values in the detected object from getImagePredection These are the results I'm getting

{
    score: 634.5586, 
    className: price, 
    rect: {
        left: -0.0002164058, 
        top: -0.3080577, 
        right: 0.00021642521, 
        bottom: 0.3093248}
}

As a result the bounding objects are not showing on the image as they seem to be offscreen and very small Not sure where I have gone wrong.

Pytorch_lite Version: v2 (v3 does not compile for me) Flutter 3.10.5 Dart: 3.0.5

Testing on actual device.

Exported my model as mentioned in the readme

python yolov5/export.py --weights yolov5/runs/train/exp/weights/last.pt --include torchscript --img 640 --optimize

Any help will be appreciated.

abdelaziz-mahdy commented 11 months ago

First check how it got displayed in the example, since those values are factors in image width and height _objectModel.renderBoxesOnImage(_image!, objDetect)

To allow you to view on anyscale with right boxes

Also can you provide the compilation error in version 3? Use latest one and just show me the logs so I fix it.

knightebsuku commented 11 months ago

Ok, Managed to find the issue by testing the example on my phone.

I had initially mis-configured the parameters in the training and the export commands.

Also managed to get 3.0 working by following Issue 24

Thanks.

abdelaziz-mahdy commented 11 months ago

Thank you for letting me know ❤️