Software Installation

Instructions of various sofware installation.

Tensorflow

安装

1
$ pip install tensorflow

测试

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

Gpu

基于tensorflow的keras中GPU的使用ref

1
CUDA_VISIBLE_DEVICES="" python3 train.py

Dlib

1
conda install -c menpo dlib

Pytorch

安装

基于Anaconda

1
$ conda install pytorch torchvision -c soumith

Octave

download

命令行安装

Ffmpeg

1
brew install ffmpeg
1
2
输入命令行ffmpeg -i src01.avi %d.jpg
回车,即可自动输出1.jpg;2.jpg……

Matlab

[download and instruction]

Anaconda

Installation

  1. Download the Anaconda Bash Script

    1
    curl -O https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
  2. Run the Anaconda Script

    1
    bash Anaconda3-2019.03-Linux-x86_64.sh
  3. Activate Installation

    1
    source ~/.bashrc
  4. Set Up Anaconda Environments

    1
    conda create --name myenv1 python=3.6

anaconda 2/3 切换

1
2
source activate /xx/xx/anaconda2
conda info --envs 查看具体位置

移动硬盘

用mac磁盘工具,插上移动硬盘,点击抹掉之后,格式选择exfat就可以了。

.sh

creen Shot 2019-04-06 at 12.00.31 P

Colab读文件

colab 读入 google drive 的文件

  1. 首先需要让colab获得google drive的授权,在google colab里执行如下代码:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    !apt-get install -y -qq software-properties-common python-software-properties module-init-tools
    !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
    !apt-get update -qq 2>&1 > /dev/null
    !apt-get -y install -qq google-drive-ocamlfuse fuse
    from google.colab import auth
    auth.authenticate_user()
    from oauth2client.client import GoogleCredentials
    creds = GoogleCredentials.get_application_default()
    import getpass
    !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
    vcode = getpass.getpass()
    !echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}

    执行时会打印一个网址和一个授权码的输入框,此时你需要点击网址,登陆google account,授权colab使用你的google drive,然后系统会分配给你一个授权码,你需要将授权码粘贴到输入框里,回车继续。

  2. 关联Google drive

    1
    2
    3
    # 指定Google Drive云端硬盘的根目录,名为drive
    !mkdir -p drive
    !google-drive-ocamlfuse drive

    此时colab中出现drive的文件夹,里面就是你的google drive的根目录文件

  3. 更换工作目录

    1
    2
    import os
    os.chdir("drive/Colab Notebooks")

Jupyter Notebook

Server

The useful link 1

Usually a remote server is equipped with GPUs. What we want is to run a notebook from server, but have the graphical interface show up in our local machine’s web browser. The libraries, hardware, and all backend-related stuff depends on your remote machine, but the GUI is seen from your laptop.

Set-up: Here, let’s define the local user and host as localuser and localhost respectively. Similarly, let’s define the remote user and remote host as remoteuser and remotehost. Needless to say, make sure that Jupyter notebook and all its dependencies are installed in both machines. Here’s a quick diagram of the whole process, I will discuss them one-by-one in the next section:

creen Shot 2020-01-22 at 5.56.01 PM-973853

  1. Run Jupyter Notebook from remote machine

    Log-in to remote machine the usual way we do. Once the console shows, type the following:

    1
    remoteuser@remotehost: jupyter notebook --no-browser --port=XXXX

    Change XXXX to the port you want. Usually the default is 8888. You can try 8889 or 8890 as well.

  2. Forward port XXXX to YYYY and listen to it

    In your remote, the notebook is now running at the port XXXX that you specified. What you’ll do next is forward this to port YYYY of your machine so that you can listen and run it from your browser. To achieve this, we write the following command:

    1
    ssh -N -f -L localhost:YYYY:localhost:XXXX remoteuser@remotehost

    ssh -N -f -L localhost:8890:localhost:8888 qwang35@mars.ece.lsu.edu

  3. Fire up Jupyter Notebook

    To open up the Jupyter notebook from your remote machine, simply start your browser and type the following in your address bar:

    1
    localhost:YYYY

In your first connection, you may be prompted to enter an Access Token as typical to most Jupyter notebooks. Normally, I’d just copy-paste it from my terminal, but to make things easier for you, you can set-up your own notebook password.

creen Shot 2020-01-22 at 6.01.51 PM-973852