hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.24k stars 1.24k forks source link

ERROR - converting tiny-yolov3 into .tflite int8 #292

Open Arfinul opened 3 years ago

Arfinul commented 3 years ago

able to detect with-

but i dont think, int8 running properly. As resulted image name is result.png not result-int8.png

with this

getting error -

File "detect.py", line 90, in app.run(main) File "/home/arfin/yolo_to_tf/lib/python3.7/site-packages/absl/app.py", line 303, in run _run_main(main, args) File "/home/arfin/yolo_to_tf/lib/python3.7/site-packages/absl/app.py", line 251, in _run_main sys.exit(main(argv)) File "detect.py", line 59, in main boxes, pred_conf = filter_boxes(pred[1], pred[0], score_threshold=0.25, input_shape=tf.constant([input_size, input_size])) File "/home/arfin/Documents/flc-yolov3-tflite/core/yolov4.py", line 301, in filter_boxes box_xy, box_wh = tf.split(class_boxes, (2, 2), axis=-1) File "/home/arfin/yolo_to_tf/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py", line 201, in wrapper return target(*args, **kwargs) File "/home/arfin/yolo_to_tf/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py", line 2026, in split value=value, size_splits=size_splits, axis=axis, num_split=num, name=name) File "/home/arfin/yolo_to_tf/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 9945, in split_v _ops.raise_from_not_ok_status(e, name) File "/home/arfin/yolo_to_tf/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 6843, in raise_from_not_ok_status six.raise_from(core._status_to_exception(e.code, message), None) File "", line 3, in raise_from tensorflow.python.framework.errors_impl.InvalidArgumentError: Determined shape must either match input shape along split_dim exactly if fully specified, or be less than the size of the input along split_dim if not fully specified. Got: 4 [Op:SplitV] name: split

Ashokcharu commented 3 years ago

I got the same error. Delete converted PB and tflite Again convert yolov3-tiny.weight to PB and PB to int8 tflite

For detection, I used this below command and it worked

python detect.py --weights ./checkpoints/yolov3_416_int8.tflite --size 416 --model yolov3 --image ./data/kite.jpg --framework tflite --tiny

Make sure you added --tiny at last