Start directly from the installation of caffe:
1. First create a new python3.5 environment
conda create -n caffe-py3.5 python=3.5 -c defaults
Enter y to install
2. Activate the environment
After the installation is completed, activate and enter the environment
source activate caffe-py3.5
3. Install the caffe-cpu version or caffe-gpu version
conda install -c defaults caffeconda install -c defaults caffe-gpu
4. Test Whether the installation is successful:
python3import caffe
If no error is reported, the installation is successful and exit python
exit()
5. Install tensorflow:
conda install -c defaults tensorflow==1.15.0
6. Installation mmdnn
pip install mmdnn
6. We take the mobilenetv1 model downloaded from the tf official website as an example. Use netron to view the pb model before conversion. Input and output nodes name, input shape:
Remember name and input shape
7. Convert pb ----> caffe, command line input:
mmconvert -sf tensorflow -iw mobilenet_v1.pb --inNodeName input --inputShape 192,192,3 --dstNodeName MobilenetV1/Predictions/Reshape_1 -df caffe -om tf_mobilenet
8. Conversion result:
Successfully converted to caffe model:
The above is the detailed content of How to solve the problem of installing caffe with conda and converting pb to caffe under Linux. For more information, please follow other related articles on the PHP Chinese website!