Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deep Sort uses a lot of CPU

I'm creating a software that reads multiple cameras in different threads with OpenCV and then process them in the main thread using YOLOv4 Tensorflow model. This way my GPU is running on around 40% capacity and my CPU cores are all around 30-40% as well in the gnome-system-monitor.

However, when I integrate Deep sort, GPU stays around the same on usage but CPU load goes to 100% on every core.

My question is, is this normal? Does Deep sort run mostly on CPU?

I'm initializing and running deep sort just like in this repo file: https://github.com/theAIGuysCode/yolov4-deepsort/blob/9e745bfb3ea5e7c7505cb11a8e8654f5b1319ad9/object_tracker.py#L48

Using:

  • Ubuntu 18.04
  • Python 3.8
  • Tensorflow 2.3.1
  • OpenCV Python 4.4.0.44
  • CUDA 10.1.243, cuDNN 7.6.5 with driver 418.152

Specs workstation laptop:

  • NVIDIA RTX Quadro 5000
  • Intel® Xeon(R) E-2276M CPU @ 2.80GHz × 12
  • 32 GB Memory
like image 368
Eli Avatar asked Jan 31 '26 20:01

Eli


1 Answers

No. It is not normal. It is a bug. Check my repo for a fix

https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch/issues/48

You need to add limits to the CPUs used by your HPC libraries like this:

# limit the number of cpus used by high performance libraries
import os
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
like image 193
Mike B Avatar answered Feb 03 '26 09:02

Mike B



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!