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
Release: 2023-05-16 14:46:14
forward
1503 people have browsed it

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
Copy after login

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
Copy after login

3. Install the caffe-cpu version or caffe-gpu version

conda install -c defaults caffeconda install -c defaults caffe-gpu
Copy after login

4. Test Whether the installation is successful:

python3import caffe
Copy after login

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()
Copy after login

5. Install tensorflow:

conda install -c defaults tensorflow==1.15.0
Copy after login

6. Installation mmdnn

pip install mmdnn
Copy after login

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
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template