Results 1 to 6 of 6
  1. #1

    Model.predict() always returning the same value of 1 for opencv

    when I try to use model.predict() in my code, it seems to not work and gives me a result of 1 every time, no matter the image I put into model.predict(), by the way Im using this to compare one picture to a training xml document based on the mean of a bunch of training pictures in a file, if you could just change it so it only uses a couple of pictures and not the training.xml then that would be fine, just do whatever is possible to either get it to return different values or so it can just detect a face then execute other aspects of it as a result

  2. #2

    Model.predict() always returning the same value of 1 for opencv

    Also, when answering this if you see any more possible errors I would like for you to point them out because I need this soon, like, in 4 hours so I'd like to get it cleared out before then, and Ive been literally working on it for the past 14 hours with only bathroom breaks, sort of given up at this point and decided to ask the internet...

  3. #3

    Model.predict() always returning the same value of 1 for opencv

    """Raspberry Pi Face Recognition Treasure Box
    Treasure Box Script
    Copyright 2013 Tony DiCola
    """
    import cv2
    import config
    import face
    import hardware
    import time
    import RPIO
    from RPIO import PWM
    import RPi.GPIO as GPIO
    import os
    import pygame
    import pygame.camera
    from array import array
    import numpy as np
    from PIL import Image

  4. #4

    Model.predict() always returning the same value of 1 for opencv

    box = hardware.Box()
    except:
    pass
    # Move box to locked position.
    box.lock()
    print 'Running box...'
    print 'Press button to lock (if unlocked), or unlock if the correct face is detected.'
    print 'Press Ctrl-C to quit.'

  5. #5
    content from reference site

  6. #6

    Model.predict() always returning the same value of 1 for opencv

    label = config.POSITIVE_LABEL
    #**Confidence declared here:**
    confidence = model.predict(crop)
    print 'Predicted {0} face with confidence {1} (lower is more confident).'.format(
    'POSITIVE' if label == config.POSITIVE_LABEL else 'NEGATIVE',
    confidence)
    if label == config.POSITIVE_LABEL and confidence < config.POSITIVE_THRESHOLD:
    print 'Recognized face!'
    box.unlock()
    else:
    print 'Did not recognize face!'
    If you need help with anything to figure out what anything does Ill willingly give it to you, the GPIO pins will be implemented later as to what they do so dont worry about them,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •