- Caffe2 - Discussion
- Caffe2 - Useful Resources
- Caffe2 - Quick Guide
- Caffe2 - Defining Complex Networks
- Caffe2 - Creating Your Own Network
- Image Classification Using Pre-Trained Model
- Verifying Access to Pre-Trained Models
- Caffe2 - Installation
- Caffe2 - Overview
- Caffe2 - Introduction
- Caffe2 - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Caffe2 - Verifying Access to Pre-Trained Models
Before you learn to use a pre-trained model in your Python apppcation, let us first verify that the models are installed on your machine and are accessible through the Python code.
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.
anaconda3/pb/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 −
CAFFE_MODELS = os.path.expanduser("/anaconda3/pb/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/pb/python3.7/site-packages/caffe2/python/models/squeezenet/init_net.pb /anaconda3/pb/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.
Now, you are ready to write your own Python code for image classification using Caffe2 squeezenet pre-trained module.
Advertisements