0

1

我有一个预先训练好的MobileNetSSd.caffemodelmodel文件MobileNetSSd.prototxt。现在我想将这些部署到管道中的 Azure ML

首先,我尝试使用以下代码注册这两个模型:

#Register the model
caffemodel = Model.register(model_path = "mobilenet_ssd/MobileNetSSD.caffemodel", #local path
                       model_name = "caffemodel",
                       tags = {"severity": "1"},
                       description = "object detection caffemodel",
                       workspace = ws)

prototxt = Model.register(model_path = "mobilenet_ssd/MobileNetSSD.prototxt",  
                       model_name = "prototxt",
                       tags = {"severity": "1"},
                       description = "object detection prototxt",
                       workspace = ws)

文件注册成功,Home/Models目录下可见

现在我需要阅读这些模型,但我无法阅读它们。

我尝试使用以下代码,但它给了我一个错误,如下所述:

from azureml.core.model import Model

global caffemodel
global prototxt
caffemodel = Model.get_model_path('caffemodel')
prototxt = Model.get_model_path('prototxt')

#错误:

    826         # Probing azureml-models/<name>
    827         if not os.path.exists(candidate_model_path):
--> 828             return Model._get_model_path_local_from_root(model_name)
    829         else:
    830             # Probing azureml-models/<name> exists, probing version

/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azureml/core/model.py in _get_model_path_local_from_root(model_name)
    870         raise ModelNotFoundException("Model {} not found in cache at {} or in current working directory {}. "
    871                                      "For more info, set logging level to DEBUG.".format(model_name, MODELS_DIR,
--> 872                                                                                          os.getcwd()))
    873 
    874     @staticmethod

ModelNotFoundException: ModelNotFoundException:
    Message: Model caffemodel not found in cache at azureml-models or in current working directory /mnt/batch/tasks/shared/LS_root/mounts/clusters/jsing2091/code/Users/jsing209/Computer_Vision/Realtime_People_Counting. For more info, set logging level to DEBUG.
    InnerException None
    ErrorResponse 
{
    "error": {
        "message": "Model caffemodel not found in cache at azureml-models or in current working directory /mnt/batch/tasks/shared/LS_root/mounts/clusters/jsing2091/code/Users/jsing209/Computer_Vision/Realtime_People_Counting. For more info, set logging level to DEBUG."
    }
}

我不知道为什么它找不到模型......我有点迷茫,如果有人可以帮我阅读这些模型,我将不胜感激

4

0 回答 0