Python 提高HOG-SVM分类器的速度/性能
我试图在视频中发现人。最初我提出了这个简单的代码Python 提高HOG-SVM分类器的速度/性能,python,performance,opencv,svm,detection,Python,Performance,Opencv,Svm,Detection,我试图在视频中发现人。最初我提出了这个简单的代码 hog = cv2.HOGDescriptor() hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) def detectPeople(foreground): start = time.time() rects, weights = hog.detectMultiScale(foreground, winStride=(2, 2), padding
hog = cv2.HOGDescriptor()
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
def detectPeople(foreground):
start = time.time()
rects, weights = hog.detectMultiScale(foreground, winStride=(2, 2), padding=(8, 8), scale=1.05)
rects = np.array([[x, y, x + w, y + h] for (x, y, w, h) in rects])
people = non_max_suppression(rects, probs=None, overlapThresh=0.65)
end = time.time()
我对视频中的每一帧都进行检测。这些是前五帧的定时结果
time: 0.9525866508483887
time: 0.9560775756835938
time: 0.9591171741485596
time: 0.9400520324707031
time: 0.9048192501068115
这简直是荒谬地接近每帧1秒。以每秒25帧的速度播放10秒的视频,需要4分钟!!!任何关于这件事的建议都将不胜感激