Deep learning NVIDIA DLI最终评估

Deep learning NVIDIA DLI最终评估,deep-learning,nvidia,Deep Learning,Nvidia,我正在参加NVIDIA DLI智能视频分析和计算机视觉课程的深度学习。 我在做最终评估时遇到了问题。这里是帮助你理解我所做的事情的链接https://medium.com/altotech/part-6-final-assessment-deep-learning-in-intelligence-video-analytics-and-computer-vision-workshop-318bb0f5458e ) 我正在按照那篇文章的指南修复一些错误。 代码如下: import caffe im

我正在参加NVIDIA DLI智能视频分析和计算机视觉课程的深度学习。 我在做最终评估时遇到了问题。这里是帮助你理解我所做的事情的链接https://medium.com/altotech/part-6-final-assessment-deep-learning-in-intelligence-video-analytics-and-computer-vision-workshop-318bb0f5458e )

我正在按照那篇文章的指南修复一些错误。 代码如下:

import caffe
import cv2
import sys
def deploy(img_path):
    caffe.set_mode_gpu()
    MODEL_JOB_DIR = '/dli/data/digits/20191203-135349-c1c3'
    ARCHITECTURE = MODEL_JOB_DIR + '/' + 'deploy.prototxt'
    WEIGHTS = MODEL_JOB_DIR + '/' + 'snapshot_iter_540.caffemodel'
    # Initialize the Caffe model using the model trained in DIGITS. Which two files constitute your trained model?
    net = caffe.Classifier(ARCHITECTURE, WEIGHTS,
                           channel_swap=(2,1,0),
                           raw_scale=255,
                           image_dims=(256, 256))

    # Create an input that the network expects. This is different for each project, so don't worry about the exact steps, but find the dataset job directory to show you know that whatever preprocessing is done during training must also be done during deployment.
    input_image= caffe.io.load_image(img_path)
    input_image = cv2.resize(input_image, (256,256))
    DATA_JOB_DIR = '/dli/data/digits/20191203-135017-353f'
    mean_image = caffe.io.load_image(DATA_JOB_DIR + '/mean.jpg')
    input_image = input_image-mean_image
# Make prediction. What is the function and the input to the function needed to make a prediction?
    prediction = net.predict([input_image])
# Create an output that is useful to a user. What is the condition that should return "whale" vs. "not whale"?
    if prediction.argmax() == 0: 
        return "whale"
    else:
        return "not whale"

!python submission.py '/dli/data/whale/data/train/face/w_1.jpg' 
错误消息是:

文件“submission.py”,第22行 prediction=net.##替换为返回网络输出的函数##([##替换为函数的输入##])

SyntaxError:无效语法

我一直在把“输入”改为“输出”


如果有人知道如何处理这个问题,请回答我。

mean_image=caffe.io.load_image(“/dli/data/digits/20180707-144641-812f/mean.jpg”)

预测

prediction = net.predict([input_image])
input_image = input_image-mean_image


# Make prediction. What is the function and the input to the function needed to make a 
prediction = net.predict([input_image])