surendramaran / YOLO

YOLOv8, YOLOv9, YOLOv10, YOLOv11 in Mobile Devices, run different machine learning model inside Android and iOS.
https://www.surendramaran.com/
Other
68 stars 24 forks source link

Tflite accuracy loss #10

Open wangyang581 opened 1 month ago

wangyang581 commented 1 month ago

I successfully installed the apk package for YOLOv8 classification on my phone using your project YOLOv8 Image Classification Android Tflite. However, I found that the accuracy of the classification model deployed on my phone was greatly reduced, resulting in many classification errors. The Tflite model I used was exported using the YOLOv8 project, and the command is as follows: yolo export model=runs/classify/classify_fight_v1.0_640n/weights/best.pt format=tflite I used the evaluation script in the YOLOV8 project to evaluate the accuracy of exporting the TFLite model, and it did not show any accuracy loss. May I ask why there is such a large deviation in its results on mobile phones? How can I make the results on my phone more accurate?

surendramaran commented 1 month ago

Thanks for reporting, may I see the model?

wangyang581 commented 1 month ago

Thank you for your reply. I have uploaded my model and apk package files to https://github.com/wangyang581/yolo-android.git , if you need me to provide other documents, please contact me

surendramaran commented 1 month ago

The accuracy dropped straight from 94% to 84%. This 84% is given by TensorFlow android interface.

As of today the current TensorFlow version for Android is 2.16.1 and the versio Ultralytics using is 2.17.0

So maybe this is the reason, can't say but the result is being given by the interface itself, unfortunately it is out of the scope of the codes used in this repo.

wangyang581 commented 1 month ago

Okay, if you have any good suggestions, please let me know. Thank you for your help.

wangyang581 commented 1 month ago

I have another issue. When I use the CAMERA button in the app to classify photos, I find that the pictures I take rotate clockwise by 90 degrees, which causes errors in the model classification results. How can I solve this problem

surendramaran commented 1 month ago

I will fix this soon, thanks for reporting

On Fri, 11 Oct, 2024, 8:14 AM wangyang581, @.***> wrote:

I have another issue. When I use the CAMERA button in the app to classify photos, I find that the pictures I take rotate clockwise by 90 degrees, which causes errors in the model classification results. How can I solve this problem

— Reply to this email directly, view it on GitHub https://github.com/surendramaran/YOLO/issues/10#issuecomment-2406439394, or unsubscribe https://github.com/notifications/unsubscribe-auth/APXHH4MJOW4GP5V4HKF2WD3Z243SVAVCNFSM6AAAAABPTXLNQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBWGQZTSMZZGQ . You are receiving this because you were assigned.Message ID: @.***>

surendramaran commented 1 month ago

Try pulling new code, and let me know it still rotate or not.

wangyang581 commented 1 month ago

I cloned new code and repackaged the APK installation package for testing. The new version of the code perfectly solved the rotation problem that occurred before, and the classification accuracy has greatly improved. Thank you very much for your help. PS: Regarding the issue of accuracy loss, I conducted tests on other phones and the results were surprising. The same installation package on another phone inferred that the same image classification result was correct, and the accuracy loss was smaller. I am sharing this discovery with you, although I do not know the reason.