Looking for support with face recognition

Greetings from Honduras bothering again.
I managed to make the part where I create the model work and it was what I got was a file that was not a photo.
but now I have 100 folders with photos ready when I run the file with 10 folders it works but when I load the *.xml file with the 100 folders it just doesn’t activate the camera for detection when it’s a small file it works.
it has opencv folder limits i am trying to use it for a small school to control biosecurity in children

# importar las librerias
import cv2
import mediapipe as mp
import os
import pyttsx3

engine = pyttsx3.init()
engine.setProperty("rate", 130)
engine.setProperty("voice", "spanish latin")


#  importar nomnbre de las carpetas
direccion = "C:/Users/valme/OneDrive/protocolo de escuelas/proyectos python/same/proyecto same/fotosP"

#direccion = "C:/Users/valme/OneDrive/protocolo de escuelas/proyectos python/same/deteccion de rostro y cubre bocas/fotos"
etiquetas = os.listdir(direccion)
print("Nombres", etiquetas)

# Llamas el modelo emtrenado
modelo = cv2.face.LBPHFaceRecognizer_create()

# ...............Declaracion del detector
detector=mp.solutions.face_detection  # detector
dibujo=mp.solutions.drawing_utils  # dibujo
# leer el modelo
modelo.read("modelP.xml")


# ...............realizamos la videocaptura
cap = cv2.VideoCapture(0)

# ...............Inicializamos los parametros de deteccion
with detector.FaceDetection(min_detection_confidence=0.75) as rostros:
       while True:
           # lectura de videocaptura
           ret, frame = cap.read()

           # eliminar el error de espejo
           frame = cv2.flip(frame, 1)
           copia = frame.copy()
           # eliminar el error de color
           rgb = cv2.cvtColor(copia, cv2.COLOR_BGR2RGB)
           crgb = rgb.copy()
           # deteccion de rostros
           resultado = rostros.process(crgb)

           # filtros de seguridad
           if resultado.detections is not None:
               for rostro in resultado.detections:
                   #dibujo.draw_detection(frame, rostro)

                   # print(rostro)
                   # extraemos el ancho y el alto de nuestra ventanas
                   al, an, _=frame.shape
                   # extrtaer xini, yini  ancho y alto
                   xi=rostro.location_data.relative_bounding_box.xmin
                   yi=rostro.location_data.relative_bounding_box.ymin
                   ancho=rostro.location_data.relative_bounding_box.width
                   alto=rostro.location_data.relative_bounding_box.height

                   # conversion a pixeles
                   xi=int (xi * an)
                   yi=int (yi * al)
                   ancho=int (ancho * an)
                   alto=int (alto * al)
                   xf=xi + ancho
                   yf=yi + alto

                   # extraccion de pixeles cara
                   cara=crgb[yi:yf, xi:xf]
                   # redimensionar las fotos
                   cara=cv2.resize (cara, (150, 200), interpolation=cv2.INTER_CUBIC)
                   cara=cv2.cvtColor (cara, cv2.COLOR_BGR2GRAY)
                   caraP = cara.copy()
                   # extraemos el ancho y el alto de nuestra ventanas
                   al, an, _ = copia.shape
                   # extrtaer xini, yini  ancho y alto
                   xi = rostro.location_data.relative_bounding_box.xmin
                   yi = rostro.location_data.relative_bounding_box.ymin
                   ancho = rostro.location_data.relative_bounding_box.width
                   alto = rostro.location_data.relative_bounding_box.height

                   # conversion a pixeles
                   xi = int(xi * an)
                   yi = int(yi * al)
                   ancho = int(ancho * an)
                   alto = int(alto * al)
                   xf = xi + ancho
                   yf = yi + alto
                   # realizar la prediccion
                   prediccion = modelo.predict(caraP)
                   t= 37
                   o=92
                   #mostrar resultado

                   print(prediccion)
                   print(etiquetas)
                   cv2.putText(copia, "".format(etiquetas[0]), (xi, yf+15), 1, 1.3, (20,100,255), 1, cv2.LINE_AA)
                   cv2.putText(copia, "t={} ,O={}% ".format(t,o), (xi, yf + 40), 1, 1.3, (0, 0, 255), 1,
                               cv2.LINE_AA)
                   cv2.rectangle(copia, (xi, yi), (xf, yf), (0,0,255), 2)


               #print(copia)
               # mostramos los fotogramas
               cv2.imshow("Reconocimiento Facial y CubreBocas", copia)

               # leyendo una tecla
               t = cv2.waitKey(1)
               if t == 27  :
                   break
      # engine.say("Listo Listo Listo fotos tomadas {} ahora colocate el cubreboca , presione [S] para continuar".format(etiquetas))
       #engine.runAndWait()
       #conti = input("¿Listo fotos tomadas {} ahora colocate el cubreboca , presione [S] para continuar")

cap.release()
cv2.destroyAllWindows()