Important!
This page has been deprecated, and the up-to-date documentation can be found here.
If you want to deploy your own local Machine Learning server to use with the Computer Vision activities follow the steps described in this page
Prerequisites
Hardware Requirements
You need a machine running Ubuntu v16.04 with the following specifications:
minimum | recommended | ||
---|---|---|---|
GPU: nVidia K80 | GPU: nVidia P40 | ||
Resolution | Time | Resolution | Time |
1280x800 | 1.349 | 1280x800 | 0.437 |
1440x900 | 1.674 | 1440x900 | 0.541 |
1680x1050 | 2.124 | 1680x1050 | 0.675 |
1920x1080 | 2.336 | 1920x1080 | 0.756 |
1920x1200 | 2.593 | 1920x1200 | 0.825 |
2560x1600 | 4.180 | 2560x1600 | 1.341 |
Note:
For the rest of the hardware specifications, see the official Ubuntu 16.04 Desktop Edition system requirements.
Software Requirements
After the machine has been provisioned, you must install the following resources:
- CUDA v9.0
- cuDNN v7.0
- Docker v v17.06.2
- NVIDIA Docker v1.0.0
- Ubuntu v16.04
Installing the Prerequisites
#!/bin/bash
# Install CUDA and cudnn
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb && \
dpkg -i ./cuda-repo-ubuntu1604_9.0.176-1_amd64.deb && \
apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub && \
apt-get update && \
apt-get install -y cuda-9-0 && \
bash -c 'echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list' && \
apt-get update && \
apt-get install -y --no-install-recommends libcudnn7=7.0.5.15-1+cuda9.0 && \
echo "************** CUDA and CUDNN install SUCCESS! **************" || echo "-------------- CUDA and CUDNN install FAILED! --------------"
# DOCKER
# Set up the docker repository
apt-get update && \
apt-get install apt-transport-https ca-certificates curl software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \ # Install Docker CE -> you might need EE.
apt-get update && \
apt-get install -y docker-ce && \
echo "************** DOCKER install SUCCESS! **************" || echo "-------------- DOCKER install FAILED! --------------"
# NVIDIA Docker
# Add the necessary repository
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
apt-key add - && \
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu16.04/amd64/nvidia-docker.list | \
tee /etc/apt/sources.list.d/nvidia-docker.list && \
apt-get update && \ # install
apt-get install -y nvidia-docker2 && \
pkill -SIGHUP dockerd && \
echo "************** NVIDIA Docker install SUCCESS! **************" || echo "-------------- NVIDIA Docker install FAILED! --------------"
# change default container runtime
echo "Docker default runtime change."
tee /etc/docker/daemon.json <<EOF
{
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
},
"default-runtime": "nvidia"
}
EOF
Running the Script to Install Prerequisites
On an Ubuntu Machine
- Use the
sudo su
command to switch to administrator mode. A line prompting you for the password is displayed. - Enter the password for the machine and press Enter. You are now connected to the machine with administrator privileges.
- Use the
vim setup.sh
command to create and edit a new text file namedstart_server.sh
. This switches to text editing mode. - Copy the script to the clipboard.
- Press i to go to
INSERT
mode and paste the script. - Press ESC to go to
NORMAL
mode. - Type
:x
and press enter to save and exit. - Use the
chmod +x setup.sh
command to turn thesetup.sh
file into an executable. - Use the
./setup.sh
command to run the script. Installation of the software prerequisites commences. - Once the installation is complete, reboot the Ubuntu machine.
By Connecting Remotely via SSH From a Windows Machine
- Open a Windows Powershell terminal.
- Use the
ssh ServerUser@server-ip
command, whereServerUser
andServer-ip
are the user and the IP of the server machine. A line prompting you for the password is displayed. - Enter the password for the machine and press Enter. You are now connected to the Ubuntu terminal.
- Use the
sudo su
command to switch to administrator mode. A line prompting you for the password is displayed. - Enter the password for the machine and press Enter. You are now connected to the machine with administrator privileges.
- Use the
vim setup.sh
command to create and edit a new text file namedsetup.sh
. This switches to text editing mode. - Copy the script to the clipboard.
- Press i to go to
INSERT
mode and paste the script. - Press ESC to go to
NORMAL
mode. - Type
:x
and press enter to save and exit. - Use the
chmod +x setup.sh
command to turn thesetup.sh
file into an executable. - Use the
bash setup.sh
command to run the script. Installation of the software prerequisites commences. - Once the installation is complete, reboot the Ubuntu machine.
Deploying the Machine Learning Model
On an Ubuntu Machine
- Download the
Controls_detection.zip
file to your machine from the link provided to you by your sales rep. - Unzip the file by using the
unzip Controls_detection.zip
command. If no unzip program is installed, runsudo apt-get install zip
and press Y when prompted to do so. - Use the
cd Controls_detection
command to navigate to the Controls_detection folder. - Use the
bash start_server.sh
command to begin deploying the server. - Wait until the installation is 100% complete and press Ctrl + C to stop any programs that might be running in the background.
- Run
bash test.sh
to test the speed of the neural network.
By Connecting Remotely via SSH From a Windows Machine
- Download the
Controls_detection.zip
file to your machine from the link provided to you by your sales rep. - Open a new PowerShell terminal on the local machine and use
cd FULL_PATH_TO_Controls_detection.zip
to navigate to the folder where theControls_detection.zip
file is located. For example, if the path of the file isC:\Users\[WINDOWS-USER]\Downloads\Controls_detection.zip
, the command should look likecd C:\Users\[WINDOWS-USER]\Downloads\
. - Use the
scp .\Controls_detection.zip ServerUser@server-ip:/UbuntuPath
command to copy the files over to the Ubuntu machine. To find out what the path on the Ubuntu machine is, use thepwd
command in the terminal connected viassh
to the Ubuntu machine. For example, if the path is/home/ML-Test
, the command should look likescp .\Controls_detection.zip ServerUser@server-ip://home/ML-Test
.
Note:
Alternatively, you can use either Putty or WinSCP to connect to the Ubuntu machine and transfer the files without using the
scp
command.
- In the terminal connected to the Ubuntu machine via
ssh
, unzip the file by using theunzip Controls_detection.zip
command. If no unzip program is installed, runsudo apt-get install zip
and press Y when prompted to do so. - Use the
cd Controls_detection
command to navigate to the Controls_detection folder. - Use the
.bash start_server.sh
command to begin deploying the server. - Wait until the installation is 100% complete and press
Ctrl + C
to stop any programs that might be running in the background. - Run
bash test.sh
to test the speed of the neural network.
Connecting to the Computer Vision Server
Important!
Once the server is deployed, to connect to it when using the Computer Vision activities, you must change the value of the URL property of the CV Screen Scope activity to
http://[MACHINE_URL]:[PORT]/v1/models/controls_detection:predict
where[MACHINE_URL]
is the address of the machine where the server is deployed, and[PORT]
is the unique port which the Docker container requires. For example, if the URL of your machine isk80-ubuntu.azure.com
, and the port you have chosen to work with is 8501, then the value of the property should look likehttp://k80-ubuntu.azure.com:8501/v1/models/controls_detection:predict
.Also, make sure you have the selected port open on the machine the model is deployed on. To do so, you have to run the following console commands, replacing
[PORT]
with the actual port you want to use:
# sudo su
# apt install firewalld
# firewall-cmd --add-port [PORT]/tcp
For example, for the default port
8501
, the command should look like:
# sudo su
# apt install firewalld
# firewall-cmd --add-port 8501/tcp
The default port through which the model is built to connect through is 8501
. It is specified in the ./controls_detection/start_server.sh
file. The line -p 8501:8501
designates the chosen port.
Changing the Default Port
To change the default port, you must do the following:
- Use the
sudo su
command to switch to administrator mode. A line prompting you for the password is displayed. - Enter the password for the machine and press Enter. You are now connected to the machine with administrator privileges.
- Use the
vim setup.sh
command to enter text editing mode for thesetup.sh
file. - Press i to go to INSERT mode and edit the
-p 8501:8501
line to-p [NEW_PORT]:8501
, where[NEW_PORT]
is the port you want to use. - Press
ESC
to go back to NORMAL mode, type:X
and press Enter to save and exit. The default port has been changed.
Updated about a year ago