![caffe训练预训练模型](https://i-blog.csdnimg.cn/blog_migrate/fa47cd68f68560d7f90bc4e69adc07d8.png)
caffe训练预训练模型
Caffe2-验证对预训练模型的访问 (Caffe2 - Verifying Access to Pre-Trained Models)
Before you learn to use a pre-trained model in your Python application, let us first verify that the models are installed on your machine and are accessible through the Python code.
在学习在Python应用程序中使用经过预先训练的模型之前,让我们首先验证模型已安装在您的计算机上并可以通过Python代码访问。
When you install Caffe2, the pre-trained models are copied in the installation folder. On the machine with Anaconda installation, these models are available in the following folder.
当您安装Caffe2时,将预先训练的模型复制到安装文件夹中。 在安装了Anaconda的机器上,这些模型在以下文件夹中可用。
anaconda3/lib/python3.7/site-packages/caffe2/python/models
Check out the installation folder on your machine for the presence of these models. You can try loading these models from the installation folder with the following short Python script −
请检查计算机上的安装文件夹是否存在这些型号。 您可以尝试使用以下简短的Python脚本从安装文件夹中加载这些模型-
CAFFE_MODELS = os.path.expanduser("/anaconda3/lib/python3.7/site-packages/caffe2/python/models")
INIT_NET = os.path.join(CAFFE_MODELS, 'squeezenet', 'init_net.pb')
PREDICT_NET = os.path.join(CAFFE_MODELS, 'squeezenet', 'predict_net.pb')
print(INIT_NET)
print(PREDICT_NET)
When the script runs successfully, you will see the following output −
脚本成功运行后,您将看到以下输出-
/anaconda3/lib/python3.7/site-packages/caffe2/python/models/squeezenet/init_net.pb
/anaconda3/lib/python3.7/site-packages/caffe2/python/models/squeezenet/predict_net.pb
This confirms that the squeezenet module is installed on your machine and is accessible to your code.
这确认squeezenet模块已安装在您的计算机上,并且代码可访问。
Now, you are ready to write your own Python code for image classification using Caffe2 squeezenet pre-trained module.
现在,您准备使用Caffe2 squeezenet预训练模块编写自己的Python代码以进行图像分类。
翻译自: https://www.tutorialspoint.com/caffe2/caffe2_verifying_access_pre_trained_models.htm
caffe训练预训练模型