google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.3k stars 5.13k forks source link

face detection model can not work wide angle or CCTV cameras, how can I adjust minimum face size for face detection #1711

Closed bharathCoitor closed 3 years ago

bharathCoitor commented 3 years ago

path=" cctv names" cap = VideoStream(src=path).start() time.sleep(2.0) with mp_face_detection.FaceDetection( min_detection_confidence=0.5) as face_detection:

while(True):

while cap.isOpened():

success, image = cap.read()

image = cap.read()
image = imutils.resize(image, width=1000)

if not success:

print("Ignoring empty camera frame.")

If loading a video, use 'break' instead of 'continue'.

continue

# Flip the image horizontally for a later selfie-view display, and convert
# the BGR image to RGB.

image = cv2.cvtColor(cv2.flip(image, 1), cv2.COLOR_BGR2RGB)

# To improve performance, optionally mark the image as not writeable to
# pass by reference.
image.flags.writeable = False
results = face_detection.process(image)

# Draw the face detection annotations on the image.
image.flags.writeable = True

image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)

if results.detections:
  for detection in results.detections:
    mp_drawing.draw_detection(image, detection)
cv2.imshow('MediaPipe Face Detection', image)
if cv2.waitKey(5) & 0xFF == 27:
  break

cap.release()

sgowroji commented 3 years ago

Hi @bharathCoitor, Can you share us in details, what trouble are you seeing with wide angle or CCTV cameras. Thanks !!

sgowroji commented 3 years ago

@bharathCoitor Could you provide details mentioned in the above comment. Thanks !

sgowroji commented 3 years ago

Hi @bharathCoitor, Closing this issue, assuming you are resolved. Thanks!