tensorflow-yolov4-tflite icon indicating copy to clipboard operation
tensorflow-yolov4-tflite copied to clipboard

How to get tflite models of a size similar to the project on Android (20 MB) ?

Open carlosparra1998 opened this issue 4 years ago • 1 comments

Hello everyone.

I need to get a tflite model from the weight obtained with the workouts (.weight), but this weight occupies about 200 MB, so when transforming this into tflite it occupies 200 MB, and then I need a much less capacity, like the original that occupies only 20 MB.

Thanks.

carlosparra1998 avatar Sep 30 '21 13:09 carlosparra1998

the demo model used in the android app is YOLOv4-tiny model

  1. check this guide to train your model link

  2. after generating your whites file save the model with this command python save_model.py --weights ./data/yolov4-tiny.weights --output ./checkpoints/yolov4-tiny-416 --input_size 416 --model yolov4 --framework tflite --tiny

  3. convert your model to tflite using this command: python convert_tflite.py --weights ./checkpoints/yolov4-tiny-416 --output ./checkpoints/yolov4-tiny-416.tflite

  4. copy model to android assets folder.

  5. change the model file name on MainActvity and DetectorActivity.

  6. open YoloV4Classifier.java and change isTiny to true

mkj98 avatar Jul 08 '22 17:07 mkj98