TensorFlow installed in the Mac environment

TensorFlow installed in the Mac environment

Foreword

    Recently the school has an experimental course called "application software development practices." This course requires completion of their topic within prescribed periods.
    Our team selected based on bank card identification system depth study of the subject, the subject requirements are as follows:

1. The data set processing
(co screenshot 1084 card and label) data set is achieved according to the present contest problems provides a data enhancement module, the data set for each picture using enhancement mode data is extended to 80 images, the image recognition after provide sufficient training data samples, and the program can continue processing module newly added data samples.
2, the program locates the bank card number
to achieve detection and location card text bank, this module can be bank card number recorded portions detected, and the interception of corresponding portions for subsequent recognition model used (card try full picture, landscape orientation), it is possible bank card to be read into the images folder.
3. The program implements bank card character recognition
module requires training data set character recognition model using data enhancement, the final model can identify the test bank card number provided and selfie contest problems of bank card number.
4. The use of a GUI (Graphical User Interface)
provides an interactive user interface to achieve good.

    According to the title given prompt, we chose to use TensorFlow to implement model training.
    Now ready to record all these, if wrong place, please correct me, I want to learn together.
    This will be a preparatory work for this experiment --- TensorFlow installation.

TensorFlow Introduction

    With deep learning increasingly hot, the gradual rise of technology, a variety of deep learning framework are endless. Currently the ubiquitous framework Tensorflow, Caffe, PyTorch, Theano, CNTK and so on.
    Internet search of the investigation, these frameworks have advantages and disadvantages, and the choice TensorFlow-- or official recommended TensorFlow may be caused by the following:

  • Google is a big company, product support and updates will be better.
  • python development compared to C ++ for a little more easily.

    The remaining number of reasons because I was a rookie, except what compile-time class for the time being not involved, do not see them here, friends who are interested can go to tensorflow features and advantages compared to other deep learning framework to see a look at the presentations and discussions you big brother.
    Next to business.

TensorFlow installation

    I use is the use of virtualenv installation. virtualenv is a project development and other Python Python isolated virtual environments on the same machine without interfering with other programs will not be affected. virtualenv the installation process, you just installed TensorFlow there all its dependencies. (In fact it is very simple) To start using TensorFlow, you need to "start" virtualenv environment. All in all, virtualenv provides a safe and reliable TensorFlow installation and operation mechanism.

installation

  1. Open a terminal.
  2. Pip install and virtualenv the following command:

    sudo easy_install pip
    sudo pip install --upgrade virtualenv
  3. Run the following command to create a virtual environment (the author of python environment version 2.7, if it does not work is 3.n version):
    virtualenv --system-site-packages tensorflow

    tensorflow here due to the virtual environment root path varies, you can choose any directory.
  4. Activate the virtual environment:
    source ~/tensorflow/bin/activate # If using bash, sh, ksh, or zsh
    source ~/tensorflow/bin/activate.csh # If using csh or tcsh

    After executing this should be prompt(tensorflow) $
  5. If pip 8.1 version has been installed or updated, do any of the following command to install in the virtual environment TensorFlow activated and all of its dependencies:
    pip install --upgrade tensorflow

    If this step is successful, skip the sixth step, otherwise perform steps sixth.
  6. If step 5 fails (usually because you use less than the 8.1 version of the pip), do any of the following command to install TensorFlow in the active virtual environment:
    pip install --upgrade tfBinaryURL

verification

    Open a new shell each use TensorFlow must activate the virtual environment. If the current virtual environment is not active (that is, not prompt tensorflow), do any of the following commands:
source ~/tensorflow/bin/activate # If using bash, sh, ksh, or zsh
source ~/tensorflow/bin/activate.csh # If using csh or tcsh
    command execution character should be: (tensorflow) $
    If you do not use TensorFlow, can use the following command to exit the environment:
(tensorflow)$ deactivate

    while you can run a python procedures to verify that the installation was successful:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

If the results are shown below, the installation was successful:
Hello, TensorFlow!

Uninstall

    Run the following command to complete the uninstall:
pip uninstall tensorflow

common problem

  1. : When installing Step 5 of the following error will occur
    matplotlib 1.3.1 requires nose, which is not installed. matplotlib 1.3.1 requires tornado, which is not installed.
    solution, execute the following command:

    sudo easy_install nose

    sudo easy_install tornado
  2. Insufficient installed numpy version, the solution is relatively simple and crude, forced to perform the upgrade:
    sudo pip install numpy --ignore-installed numpy
  3. pip install tensorflow time being given enough authority, directly followed by the--user

End

    Come on, roll to learn.

Guess you like

Origin www.cnblogs.com/yeungchiho/p/10935450.html