Home >Operation and Maintenance >Linux Operation and Maintenance >How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

PHPz
PHPzforward
2023-05-16 14:46:141621browse

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

How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

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

How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

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

How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

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:

How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

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:

How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

Successfully converted to caffe model:

How to solve the problem of installing caffe with conda and converting pb to caffe under Linux

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete