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

Running yolov5 on CPU #37

Closed
riadsouissi opened this issue Jun 11, 2020 · 7 comments
Closed

Running yolov5 on CPU #37

riadsouissi opened this issue Jun 11, 2020 · 7 comments
Labels
enhancement New feature or request Stale

Comments

@riadsouissi
Copy link

riadsouissi commented Jun 11, 2020

Hi.
With such high fps with the small yolov5 model, would it run decently on a cpu configuration (xeon processor for instance)?

@riadsouissi riadsouissi added the enhancement New feature or request label Jun 11, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Jun 11, 2020

Hello @riadsouissi, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@glenn-jocher
Copy link
Member

glenn-jocher commented Jun 11, 2020

@riadsouissi yes absolutely! I do all my development on a 2018 MacBook Pro (no CUDA devices), and if I run the webcam demo at the default --img-size 640 I get about 5 FPS on CPU:

(env1) glennjocher@Glenns-MBP yolov5 % python detect.py --source 0
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', fourcc='mp4v', half=False, img_size=640, iou_thres=0.5, output='inference/output', save_txt=False, source='0', view_img=False, weights='weights/yolov5s.pt')
Using CPU

1/1: 0...  success (1280x720 at 29.00 FPS).

0: 384x640 Done. (0.266s)
0: 384x640 1 persons, Done. (0.217s)
0: 384x640 1 persons, Done. (0.218s)
0: 384x640 1 persons, Done. (0.207s)
0: 384x640 1 persons, Done. (0.209s)
0: 384x640 1 persons, Done. (0.209s)
0: 384x640 1 persons, Done. (0.208s)
0: 384x640 1 persons, Done. (0.210s)
0: 384x640 1 persons, Done. (0.210s)
0: 384x640 1 persons, Done. (0.207s)

If I reduce to --img-size 320 I get about 15-20 FPS on CPU:

(env1) glennjocher@Glenns-MBP yolov5 % python detect.py --source 0 --img 320
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', fourcc='mp4v', half=False, img_size=320, iou_thres=0.5, output='inference/output', save_txt=False, source='0', view_img=False, weights='weights/yolov5s.pt')
Using CPU

1/1: 0...  success (1280x720 at 29.00 FPS).

0: 192x320 1 persons, Done. (0.096s)
0: 192x320 1 persons, Done. (0.064s)
0: 192x320 1 persons, Done. (0.064s)
0: 192x320 1 persons, Done. (0.058s)
0: 192x320 1 persons, Done. (0.062s)
0: 192x320 1 persons, Done. (0.063s)
0: 192x320 1 persons, Done. (0.062s)
0: 192x320 1 persons, Done. (0.061s)

If you download our iDetection app, you will get 30+ FPS also on the latest iPhones. All of Apple's recent mobile devices (iPads, iPhones, etc) actually run YOLOv5 much faster than Intel CPU devices like MacBooks. This is due to the ANE, which for the last two years has had about 5 TOPS of power, and is likely due for a significant boost with the fab process reduction this year to 5nm.

@riadsouissi
Copy link
Author

Thanks for the prompt feedback!

@rkinas
Copy link

rkinas commented Jun 11, 2020

Hi,
BTW does iDetection app support y5? I just downloaded it on iPad Pro and can see only y4.

@glenn-jocher
Copy link
Member

@rkinas ah, yes. This is on our TODO list. Unfortunately we are stretched pretty thin, but probably by next week we will have new y5 models exported to iDetection.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@themrmax
Copy link

If anyone ends up here because train.py is hanging, I had to use --workers 0 to get it to run on my 2017 Macbook Pro, I thinks it's related to this issue pytorch/pytorch#1355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale
Projects
None yet
Development

No branches or pull requests

4 participants