Eli
Eli

Reputation: 183

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:

Specs workstation laptop:

Upvotes: 3

Views: 2154

Answers (2)

Tony
Tony

Reputation: 1

in _cosine_distance, numpy arrays should declare dtype.

if not data_is_normalized:
    a = np.asarray(a) / np.linalg.norm(a, axis=1, keepdims=True)
    b = np.asarray(b) / np.linalg.norm(b, axis=1, keepdims=True)

change to:

if not data_is_normalized:
    a = np.array(a, dtype=np.float128) / np.linalg.norm(a, axis=1, keepdims=True)
    b = np.array(b, dtype=np.float128) / np.linalg.norm(b, axis=1, keepdims=True)

Upvotes: 0

Mike B
Mike B

Reputation: 3476

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"

Upvotes: 1

Related Questions