abars / YoloKerasFaceDetection

Face Detection and Gender and Age Classification using Keras
MIT License
209 stars 81 forks source link

Video frame openning Error #1

Closed kirankumarsoni closed 5 years ago

kirankumarsoni commented 6 years ago

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV Unable to stop the stream: Device or resource busy Traceback (most recent call last): File "agegender_demo.py", line 322, in main(sys.argv[1:]) File "agegender_demo.py", line 297, in main img = img_bgr[...,::-1] TypeError: 'NoneType' object has no attribute 'getitem'

ahmadshabbir2468 commented 6 years ago

This Slove my problem

`while True:

Face Detection

    ret, frame = cap.read()  # BGR

    if(ret):
        img=frame
        inputs = img.copy() / 255.0

        if(DEMO_IMG!=""):
            img = caffe.io.load_image(DEMO_IMG) # load the image using caffe io
            inputs = img

        transformer = caffe.io.Transformer({'data': net_face.blobs['data'].data.shape})
        transformer.set_transpose('data', (2,0,1))
        out = net_face.forward_all(data=np.asarray([transformer.preprocess('data', inputs)]))
        img_cv = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
        print(img.shape[1])
        results = interpret_output(out['layer20-fc'][0], img.shape[1], img.shape[0])

        #Age and Gender Detection
        show_results(MODE,img_cv,results, img.shape[1], img.shape[0], net_age, net_gender, net_emotion, model_age, model_gender, model_emotion)

        k = cv2.waitKey(1)
        if k == 27:
            break

` But Now I cant Get Any Result

        results = interpret_output(out['layer20-fc'][0], img.shape[1], img.shape[0])

Returns Empty List

abars commented 5 years ago

I removed caffe dependency. Please retry agegender_demo.py.