Hi, I’m a handsome guy, and I’m going to explore artificial intelligence! The purpose of this article is to record the process of installing Tensorflow for future review. Help friends to build a learning environment. If you can see this article, it will prove that I have successfully set up a learning environment, installation steps are reliable.

preface

1. Why should I learn Tensorflow?

Because I want to learn Linux, Learn Python, learn Docker, learn Git, learn Tensorflow, just greedy.

2. How do I overcome acclimation on Linux?

I’m addicted to the Windows graphical interface myself, but switching to the Linux command line mode definitely feels uncomfortable.

First we must install the pure English version when installing the virtual machine. At the root of all this fear of the command line is your fear of remembering English words.

Then we have to force ourselves to use the command line. It doesn’t matter if we don’t understand the command line at the beginning. If we look it up more often, we will know that the prefix “Linux uses the command line to implement XXXX” in the search.

Finally is to see more learn more practice, spend time can be proficient

3. How to get started with Tensorflow?

If you want to learn Tensorflow, the key is to understand it

What is a tensor? What is a flow? Understand the relationship between deep learning and Tensorflow. I still don’t want to stick to python code.

Learning resources I recommend:

Tensorflow Tutorial in Chinese – with video

Tensorflow Introduction video Tutorial – interactive

Tensorflow Chinese community

To prepare

64-bit Ubuntu16.04LTS vm





Vm Settings

4G memory (minimum, because ai needs a lot of memory, which is only enough for learning)

65GB hard drive (the more the better, because we need to download a lot of data sets to train the model)

There’s nothing else to talk about. Do it!

Install Tensorflow

1. Install git

Sudo apt-get install git —–

Git –version —– verify

2. InstallBazel

Official tutorial —- very official

A. JDK8 installation (required)

Sudo add-apt-repository PPA: Webupd8team/Java —-

Sudo apt-get update —-

Sudo apt-get install oracle-java8-installer —-

Java-version —- Verifies the installation

The installation of b.B azel

Echo “deb [arch = amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8” | sudo tee /etc/apt/sources.list.d/bazel.list

curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add –     

sudo apt-get update && sudo apt-get install bazel

bazel version

3.Tensorflow source code installation

The official tutorial

Package dependency check (just copy it all in)

sudo apt-get update&&sudo apt-get install -y \       

build-essential \       

curl \       

libcurl3-dev \       

git \       

libfreetype6-dev \       

libpng12-dev \       

libzmq3-dev \       

pkg-config \       

python-dev \       

python-numpy \       

python-pip \       

software-properties-common \       

swig \       

zip \       

zlib1g-dev

Tensorflow real installation

Git clone – recurse submodules – https://github.com/tensorflow/serving – pull the source code

cd tensorflow                                                                                           

/configure —- Configures tensorflow

cd..

You will be asked questions when you run configure

Please specify the location of python. [Default is /usr/bin/python]:

/usr/bin/python                            –

Please specify optimization flags to use during compilation [Default is -march=native]:

-march=native

Do you wish to use jemalloc as the malloc implementation?  [Y/n]

y

Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]

y

Do you wish to build TensorFlow with Hadoop File System support? [y/N]

y

Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N]

y

Do you wish to build TensorFlow with OpenCL support? [y/N] 

N (Virtual machines do not use OpenCL)

Do you wish to build TensorFlow with CUDA support? [y/N]

N (This is not necessary if the VM does not have CUDA)

Only after the configuration is successful

4. Install Tensorflow Python API

sudo apt-get install python-pip python-dev                     

sudo pip install tensorflow

test





Congratulations to you! You have successfully installed Tensorflow!

Run the Model in the Tensorflow source code

This is the introductory example for the tutorial, which is Tensorflow’s Hello World. The initial operation is slow, and the data set needs to be downloaded (about 20M).

cd serving/tf_models/tutorials/image/mnist

python convolutional.py





The model is being trained

If you want to run another model you can refer to it

Google open-source all models

Each model corresponds to a readme. md, and then to the corresponding Bazel command, just play along. Note that most models need to download data sets (large), so I won’t do that here.

Python IDE to build

I’m a Java developer. So I chose the Eclipse + Python plug-in

Eclipse installation

(I chose the JEE version because the purpose of my study was to develop a Web call to the RPC service provided by TensorFlow)

CD Downloads —- Put the files in the Downloads folder

sudo wget sudo wget http://eclipse.stu.edu.tw/technology/epp/downloads/release/neon/2/eclipse-jee-neon-2-linux-gtk-x86_64.tar.gz

tar -zxvf eclipse-jee-neon-2-linux-gtk-x86_64.tar.gz

cd eclipse

sudo ./eclipse

Install the PyDev plug-in

conclusion

After a week of study, I felt more and more that the code is just a way of expression, what is important is the thought behind the code. In the process of learning Tensorflow, I gradually realized the importance of English ability. Since then, I have forced myself to surround myself with English, believing that it will help me adapt to English.

I think sophomores are the most suitable students to learn Tensorflow, because they have just finished the course of advanced mathematics and linear algebra. Normally, they have passed the level 4. But only if you read the documentation and tutorials in English.

The motivation for self-education begins with panic and ends with panic. In the process of learning, I think the most important thing is to overcome inner loneliness. This inner loneliness is not only caused by your lack of sociability because of your focus, but more by your desire for external attention and recognition. This means a lack of self-assessment and motivation in the process of self-study. When it comes to programming, it’s very difficult for others to correct your mistakes from the outside. The best mentors can only tell you the possible causes of your mistakes and the direction of your efforts, mostly through your own exploration and exploration. So I always tell my friends that programmers Debug every day. In fact, this is growing up.