Ai This concept seems to suddenly fire up, the beginning of the big score to win Li Shishi Alphago success attracted a lot of attention, but in fact, look at your phone's voice assistant, face recognition on the camera, today's headlines to help you automatically filter out the news, as well as the major music software song "Daily Recommended" ... All kinds of AI have already entered all aspects of our lives. Profoundly affected us, it can be said, this is an AI era.
In fact, at the end of last year, Google on the open source of its use to make Alphago deep learning system TensorFlow, I believe many students have been to this powerful machine learning system, but although about TensorFlow tutorial actually many, Even Google official on the TensorFlow's website gave a detailed tutorial, also has a website has been translated into Chinese (click to view), but it is still a threshold, Especially for the computer and programming language not deep understanding of the students, may look at the page of the code given in a vacuum into a confused force.
And what I'm going to do today is take all these students who have almost no programming foundation but want to learn tensorflow to cross this hurdle. To tell you how to get everything you need to program with TensorFlow, and how to understand what those code on the tutorials mean, then don't say much, we'll start right away.
installation under the Linux operating system
Installation Environment
The support list for TensorFlow is not windows. While Docker can be used to run on windows, there are a lot of small problems, and it supports the best UNIX kernel-based systems such as Linux, so we'd better install a Linux environment to run it. Linux is a free open-source operating system that is widely used, such as the famous Android is a Linux-based improved operating system for mobile phones. And for us, the most understandable version is the famous Ubuntu, click on the link to download the official website, as mentioned above, download and use are free.
If you're using a Mac, that's a lot easier, because Mac OS itself is a UNIX-based operating system that already has all the components you need to install TensorFlow. So many steps of the installation can be omitted, direct TensorFlow installation, but the command is different from Ubuntu. But you can also take a look at the next tutorials that will help you understand those commands. Uh...... You said you had Windows installed on your Mac?
After downloading, you will get an. iso file with an Ubuntu system installed. There are two ways to deal with it, the first is to install directly, with the computer is now in use of the system to form a dual system (of course you can also replace the current system, but I think no one will be willing to do so haha). If you don't want to do that, you can also use virtual machines to virtual a system. However, installing a virtual machine is a requirement for configuration, after all, it is equivalent to opening two systems on your computer at the same time-theCPU is best not less than the 4 generation i3 (especially the notebook, the four-digit number of the CPU model of the I3/5/7-XXXX the first x represents its algebra). Memory-Note that the memory must not be less than 4g, because the memory you allocate to the virtual machine will be 1:1 off your physical memory after the virtual machine starts. Plus the consumption of the physical machine system. Of course, this configuration table is limited to the lower limit, the better your computer configuration, the better the experience. In the case of dual-system installation, the need for configuration is much smaller.
In a virtual machine installation
Online related tutorials are more, here do not repeat, pay attention to the search for the installation of dual-system tutorial time to add your current system and the version number of the Ubuntu system you downloaded. Here are just a few points to note.
Because Linux is very important to security, and therefore not only the authority management is very strict, when creating the operating system will also require you to enter a password, this password will be used to log in and get root permissions. For example, the above interface, if you do not fill all the blanks are not able to point the next step.
Python
Ubuntu desktop Look, (quietly say I think Unix-based systems are generally more beautiful than Windows, mainly fonts look really comfortable)
After the installation, we saw some familiar software and some unfamiliar software, we do not care about it, introduce Python. Python is a high-level language that is characterized by its simplicity, but because it is concise, it translates it into instructions that the CPU can understand-that is, executing code at a slower rate than some lower-level languages, such as C. However, in the face of computer performance, this speed difference most of the time is not a problem at all.
Interpreter
Many people may find python very abstract, because when it comes to python, people don't think of it as if it had a dedicated compiler. Python can perform a strange place. It is even easy to execute directly on the system's terminal (a tool similar to the command line in Windows). Ubuntu comes with Python, so it's generally not annoying to install.
TensorFlow supports a variety of front-end languages, but support for Python is best, so our tutorials are based on Python , first we open the terminal. As a very important part of Ubuntu, there are many ways to open it. For example, right-click on the desktop
You can also click on the Ubuntu icon in the top left corner to search. You can see the terminal window as shown below when you open it. The @ Sign in the title bar is preceded by your user name.
If you have never left the graphical user interface in your computer usage history (that is, there is a mouse and a lot of icons for you to point to the kind). See this simple scary window don't panic, just enter the correct command.
Before I begin, I would like to say: Be sure to note the hints given in the window. In the actual operation may encounter a variety of problems, but the common problems can be based on its error information to find the reason, as long as the internet search for the corresponding information can be resolved, and even it will give a solution to the proposal. If you find that your steps are all right, but just can't succeed, try a few more times, after all, these services are provided by Google, and Google ... You know.
Essential Python-pip and Python-dev.In this window, enter the command: $ sudo apt-get install Python-pip Python-dev
Notice that there is already a $ symbol in the window, so you do not have to include the $ symbol when copying or entering the command, but the online tutorials usually include the symbol as a sign. Just take care of yourself.
The command at the very beginning of sudo means that this command will be executed as root, so you need to enter the password you set at the beginning, noting that the input process will not be reflected on the screen. Press ENTER directly after the loss.
A string of code appears and asks if you want to continue, enter Y
Then you can wait for the installation to complete, explain this command:apt-get is a command to obtain software from the software repository, which is a common feature of major Linux distributions: It is a series of servers or Web sites that hold software, including packages and index files, Users can easily use the command to automatically locate and install the software, while eliminating the hassle of searching everywhere. Install is the installation instruction, while PYTHON-PIP and Python-dev are the names of two packages that need to be installed. Pip can be understood as a more advanced software installer, installed TensorFlow to use, and Dev is an additional class library, is also tensorflow installation and operation needs. If all goes well, after a large series of English strokes, we will see the following interface:
at this point, you can install the TensorFlow, instructions are as follows:
$ sudo pip install--upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_ X86_64.whl
As I said earlier, you may encounter problems like this, such as
In these moments, do not panic, read the error message carefully, the more often the more important, because the conclusion is given at the end, like this last:
You see, it tells you not only what you should try to do, but what you do. Just do as it says.
However, I did not use the 8.1.1 version, using the Upgrade command is only upgraded to the 8.1.1 version, again enter the same command, it will tell you that your version is up to date. But the problem did resolve, and the hint did not appear again.
The update updates the version to 8.1.1, and then this tip won't bother you anymore.
Re-enter the command to install TensorFlow, if not, try a few more times,
Look closely at the information of these yellow words, you will find the network is unreachable such words, if you have any legendary weapon, it is time to take out the use. But it doesn't matter, try a few more times, or you can succeed.
When this interface appears, you can take a breath, because the installation is complete, now you can use the TensorFlow, let's follow the tutorial to the world to say hi.
The way to get into the Python environment from terminal is also straightforward, by typing the command directly: Python. If the machine has python,terminal installed, it will display the Python version number and other information, and the next instruction prefix will be a string of characters such as the user name into something like this: ">>>", which indicates that the entry is complete.
Follow the command line with the code, syntax I don't explain here
In order to get to this point, you may have done a lot of hard work, there may have been a lot of mistakes in the middle, but believe that when you see that the program is actually running in accordance with your instructions, you will feel that it is worth it.
#彩蛋时间 #
1. The first thing programmers usually do when they are in touch with a new language is to write a Hello World program, which derives from the hopes of the first group of great gods for computer programs, hoping that they will be as friendly as a newborn to announce its arrival to the universe.
2. The meaning of the number 42 is very profound. According to a famous science fiction "Hitchhiker's Guide to the Milky Way", 42 is an answer to the question of "Life, the Universe and Everything" (huh? You asked me what the problem was? )。 Google's founders are probably also a fan of the novel, because Google has embedded the eggs in their search engines, and Google has a "42" model outside its headquarters.
Large Program Development Prerequisites: IDE (Integrated development environment)
Although the terminal can be programmed directly, but we always need a tool, or to make up a large program is almost impossible to complete. This is the time for the IDE to come out. You will be pleasantly surprised to find that the familiar programming interface that you have seen in C has come back (of course, many of them are charged). In fact, because Python is open source, theoretically anyone who is strong enough can develop an IDE for it, and indeed a lot of people do. Cattle are too many people, they make the tools which are inferior to everyone has no unified opinion, so we simply do not introduce which one, which caused a lot of people on the python "abstract" feeling.
There are many useful Ides, this article describes the Komodo IDE's free version of Komodo Edit. Open its official website under Linux (click on the link http://komodoide.com/download/edit-linux64/#), the download is a compressed file. Click the right button to unzip.
Some third-party software installed in Linux is not the same as windows, for example, there is a install.sh in its folder.
This is actually the installation file, but it is not possible to open it directly, and it has to be done in terminal to install it. Enter terminal, make sure you are in a normal, not Python environment, and enter the folder where the installation file is located by entering the Cd+ folder name, such as entering the Download folder, type: cd Download (Python is case sensitive, So it's best to get into the habit of sizing when typing. ), because when you enter an installation command, the program searches for the name of the installation file only in the folder (excluding subfolders) that you currently reside in. people who are accustomed to the graphical interface may be a little dizzy, but just keep in mind the following to find your way home: This is the default File Manager interface for your folder when you open terminal. In the beginning you can open the folder while opening the graphical interface, while tapping the corresponding path in the terminal, so you won't get lost.
Of course, some of the software has a simpler way to install, not here.
After you reach the interface where the installation file is located, enter the./+ file name, as in this example, enter./install.sh, the effect is as follows:
Follow the path given in the information to find the file that started the program, in this case the file in the bin.
The next setup is almost the same as in Windows.
When opened, let's experiment with a relatively simple algorithm presented in the "Introduction" section of the official tutorial.
Click New File
Click Language Selection in the upper-right corner and select Python so that you can check for some syntax errors during the input process.
(If you copy it directly, it will bring some strange code in the Web page, which will cause the program to run in error, as shown in the example below, so you need to delete the Chinese comment.) Save the input code as *.py, which is the suffix name of the python file. Can be called through terminal. Follow the previous method in the terminal into the folder where the files are stored, the path in this article is as follows:
Then enter the python+ file name, in this case Python text-3.py, because the algorithm is very simple and will soon get results. Is there a full sense of accomplishment?
Summary
In fact, this tutorial just opened a very small and small head, explained some of the most basic knowledge about TensorFlow, including installation in other environments, GPU support, and so a little more complicated things are not mentioned. But in fact, the process from 0 to 1 is the biggest factor that has baffled many people. After understanding these things in the tutorial, I believe that understanding TensorFlow's official tutorial has no difficulty for you, if you follow the official course, you will find that these things are not difficult, I believe that with the wisdom of you will be able to learn. Then this tutorial is here, you come on, maybe create the next alphago is you.
This text link: http://www.leiphone.com/news/201606/ORlQ7uK3TIW8xVGF.html
"Go" really start from scratch, TensorFlow detailed installation of the Getting Started Tutorial! (Help you do the hardest one from 0 to 1)