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

body=cv2.CascadeClassifier('haarcascade_fullbody.xml')
cap = cv2.VideoCapture(0)
cap.set(3,1280)
cap.set(4,720)
while True:
    ret, img = cap.read()
    detection=body.detectMultiScale(img,scaleFactor=1.5,minSize=(50,50))
    for (x,y,w,h) in detection:
        cv2.rectangle(img,(x,y),(x+w,y+h),(0,0,255),2)
    cv2.imshow('Capture', img)
cap.release()

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