Python 预测Vgg16的输出,混淆

Python 预测Vgg16的输出,混淆,python,keras,Python,Keras,我试图了解我们如何处理模型的结果 yhat=model.predict(图),我在研究什么样的回报,但它是一种结构。。。但后来我在网上发现了这个,这让我很困惑 有人能帮我理解model.predict([x])[0][0] 我试图得到一个值,这样我就可以看到它是这样或那样。这是一个两级分类 谢谢 def get_predicition(image): height, width = image.shape[:2] try: # If in case face is not det

我试图了解我们如何处理模型的结果

yhat=model.predict(图),我在研究什么样的回报,但它是一种结构。。。但后来我在网上发现了这个,这让我很困惑

有人能帮我理解model.predict([x])[0][0]

我试图得到一个值,这样我就可以看到它是这样或那样。这是一个两级分类

谢谢

def get_predicition(image):
    height, width = image.shape[:2]
    try: # If in case face is not detected at any frame
        face = face_detector(image, 1)[0]  # Face detection
        x, y, size = get_boundingbox(face=face, width=width, height=height) # Calling to get bound box around the face
    except IndexError:
        pass
    cropped_face = image[y:y+size, x:x+size] # cropping the face 
    output,label = evaluate(cropped_face) # Sending the cropped face to get classifier result 
    font_face = cv2.FONT_HERSHEY_SIMPLEX # font settings
    thickness = 2
    font_scale = 1
    if label=='Real':
        color = (0,255, 0)
    else:
        color = (0, 0, 255)
    x = face.left()    # Setting the bounding box on uncropped image
    y = face.top()
    w = face.right() - x
    h = face.bottom() - y
    cv2.putText(image, label+'_'+str('%.2f'%output)+'%', (x, y+h+30), 
            font_face, font_scale,
            color, thickness, 2) # Putting the label and confidence values

    return cv2.rectangle(image, (x, y), (x + w, y + h), color, 2)# draw box over face

def evaluate(cropped_face):
    # Read the image and resize it
    img = cv2.resize(cropped_face, (224, 224))

    # Reshape
    x = img.reshape((1,) + img.shape)
    x /= 255.

    result = model_Xc.predict([x])[0][0] # result = model_Xc.predict([x])[0][0]

    if result > 0.5:
        animal = "cat"
    else:
        animal = "dog"
        result = 1 - result

    return result, animal
它提供结果数组中的最小值


它从结果数组中为您提供最大值

这是什么库?我使用的是keras、vgg16和VGG19,我们需要查看足够的代码,以便能够准确地找出该方法的来源。这对您有帮助吗?但问题是这能做什么?预测([x])[0][0]——预测([x])[0]。谢谢,我正在试图弄清楚它是做什么的,为了做到这一点,我需要知道
model\u Xc的类型。
res = model_Xc.predict(img)[0][0]

res = 0.026140803
res = model_Xc.predict(img)[0][1]