Yumi's Blog

Use pretrained YOLO network for object detection, SJSU data science night (Setup)

Setup

Please take the following steps in Max OSX (Sorry for Windows users).

Anaconda 3.7

Please visit Anaconda 3.7 for installation. Note: This will take 2.26GB of space on your computer. The installation took me about 7 MIN.

  • Press "Continue" at every step and agree to the terms of the software license agreement.

Install Anaconda

Set up virtual environment

A virtual environment is a named, isolated, working copy of Python that that maintains its own files, directories, and paths so that you can work with specific versions of libraries or Python itself without affecting other Python projects.

  • Open terminal by searching "terminal" in spotlight.

OpenTerminal

  • Let's check if conda is correctly installed. In terminal, type:

    conda -V

condaV If conda is installed you should see the conda version. (This step should work if you correctly installed anaconda 3.7).

  • Make the conda up to date by typing the following command to terminal:

    conda update conda

    When "Processed ([y]/n)?", answer by hitting y.

conda_update_conda

  • Create a virtual environment with name DataScienceNightSJSU

    conda create -n DataScienceNightSJSU python=3.6.3 anaconda

    • Here, we specify the python version to 3.6.3.
    • When "Processed ([y]/n)?", answer by hitting y.

      condacreate1 condacreate2

  • Activate your virtual environment

    Activating a conda environment modifies the PATH and shell variables to point to the specific isolated Python set-up you created.

    source activate DataScienceNightSJSU

    You can also see all available conda environments by typing conda info -e .

condinfoe

Refernece:ΒΆ

If you want to know the details of each step to create a virtual environment, please visit this website: Create virtual environments for python with conda

Install three additional python packages: tensorflow, keras, opencv

Anaconda is a convinent package manager that comes with most of the common python packages for do data analysis in python. However, to run my deep learning scripts, you need to separately install three more packages: two deep learning packages (Keras and tensorflow) and a computer vision package, opencv, in your environment.

  • Note 1: It is very important to install the correct versions of these modules.
  • Note 2: You do NOT need GPU to follow this blog series as we will only use pre-trained network.

To install the three packages in your DataScienceNightSJSU environment, from your terminal run the following codes:

conda install tensorflow==1.9.0
conda install keras==2.1.2
conda install opencv==3.4.2
  • When "Processed ([y]/n)?", answer by hitting y.
  • Here is how my terminal looks like when I run the above commands in my terminal.

conda install tensorflow==1.9.0

tensorflow (1)

conda install keras==2.1.2


keras (1)

conda install opencv==3.4.2


opencv (1)

Download workshop specific codes

To follow the tutorial, you need to download some files that I created.

Screen Shot 2019-01-27 at 12.26.25 PM

  • Step 2: Please download weights_yumi.h5 (194MB) from my Dropbox, and save it in the GitHub repository you just downloaded in Step 1.

    • The folder contains the pre-trained YOLO weights named "weights_yumi.h5" (194MB).
    • This folder is not part of the GitHub repository because the file size of "weights_yumi.h5" exceeds GitHub's file size limit of 100.00 MB.

Screen Shot 2019-01-27 at 12.11.20 PM

  • Step 3: Open ipython notebook: Open your terminal, (activate the virtual environment that you just created) and then type:

      jupyter notebook

    Screen Shot 2019-01-27 at 3.12.19 PM A window will pop up in your browser. jupyternotebook

  • Step 4: Direct to the folder that you just downloaded from GitHub, and open the ipython notebook titled "Step_by_Step_DataScience_Night_Complete.ipynb"

openipythonnotebook

Now you are good to go!

Comments