Best way to make haar cascade detection of human body

I am experiencing issues in detecting human body with default “haarcascade_fullbody.xml” in python, i need this for my school project on raspberry pi. This code “kinda” works, however its not very good at recognizing humans. I really need light code which can detect humans efficiently, i am new in opencv, however i know python pretty good

import cv2

cap = cv2.VideoCapture(0)
while True:
    ret, img =
    for (x,y,w,h) in detection:
    cv2.imshow('Capture', img)

user a smaller scaleFactor, something closer to 1.0 (1.0 and less is invalid)

haar cascades are old technology. they will always be worse than current technologies.

So, what is the most modern technology for the analysis and detection of objects? What can you recommend me

deep neural networks.

there are plenty of models for generic object detection (hundreds to thousands of object classes) and if you want ONLY humans, you can either use one of those and discard all non-human detections, or retrain/fine-tune (transfer learning) on whatever datasets of humans you can get your hands on.

okay, thank you really much