Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TF Lite exports #9517

Merged
merged 2 commits into from
Sep 20, 2022
Merged

Fix TF Lite exports #9517

merged 2 commits into from
Sep 20, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Sep 20, 2022

Signed-off-by: Glenn Jocher glenn.jocher@ultralytics.com

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improvements to documentation or project management with no code changes.

πŸ“Š Key Changes

  • No actual code changes were introduced in this PR.
  • Possible updates to documentation, comments, or non-code files in the repo.

🎯 Purpose & Impact

  • Enhance understanding for developers and users by improving non-code content.
  • Maintain project organization, possibly preparing for future code changes.
  • No direct impact on the software's functionality, performance, or user experience.

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher glenn-jocher self-assigned this Sep 20, 2022
@glenn-jocher
Copy link
Member Author

Resolves

!python detect.py --weights yolov5s-fp16.tflite

detect: weights=['yolov5s-fp16.tflite'], source=data/images, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1
YOLOv5 πŸš€ v6.2-146-ge233c03 Python-3.7.14 torch-1.12.1+cu113 CUDA:0 (Tesla V100-SXM2-16GB, 16160MiB)

Loading yolov5s-fp16.tflite for TensorFlow Lite inference...
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
  File "detect.py", line 255, in <module>
    main(opt)
  File "detect.py", line 250, in main
    run(**vars(opt))
  File "/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 126, in run
    pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det)
  File "/content/yolov5/utils/general.py", line 870, in non_max_suppression
    conf, j = x[:, 5:mi].max(1, keepdim=True)
IndexError: max(): Expected reduction dim 1 to have non-zero size.

@glenn-jocher glenn-jocher merged commit bd35191 into master Sep 20, 2022
@glenn-jocher glenn-jocher deleted the fix/tf branch September 20, 2022 16:47
@zhiqwang
Copy link
Contributor

@glenn-jocher Seems like nothing has been updated here in this PR.

@glenn-jocher
Copy link
Member Author

@zhiqwang yes, you're right! I forgot to add the main change, added in #9518

TFLite models were outputting inference in different orders on some systems, so this removes training outputs on export, leaving a single detection output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants