This is the suggested way to install the Torch ResNet dependencies on Ubuntu 14.04+:
- NVIDIA CUDA 7.0+
- NVIDIA cuDNN v4
- Torch
- ImageNet dataset
- NVIDIA GPU with compute capability 3.5 or above
- Install the
build-essential
package:
sudo apt-get install build-essential
- If you are using a Virtual Machine (like Amazon EC2 instances), install:
sudo apt-get update
sudo apt-get install linux-generic
-
Download the CUDA .deb file for Linux Ubuntu 14.04 64-bit from: https://developer.nvidia.com/cuda-downloads. The file will be named something like
cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
-
Install CUDA from the .deb file:
sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
echo "export PATH=/usr/local/cuda/bin/:\$PATH; export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:\$LD_LIBRARY_PATH; " >>~/.bashrc && source ~/.bashrc
- Restart your computer
-
Download cuDNN v4 from https://developer.nvidia.com/cuDNN (requires registration). The file will be named something like
cudnn-7.0-linux-x64-v4.0-rc.tgz
. -
Extract the file to
/usr/local/cuda
:
tar -xvf cudnn-7.0-linux-x64-v4.0-rc.tgz
sudo cp cuda/include/*.h /usr/local/cuda/include
sudo cp cuda/lib64/*.so* /usr/local/cuda/lib64
- Install the Torch dependencies:
curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash -e
- Install Torch in a local folder:
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; ./install.sh
If you want to uninstall torch, you can use the command: rm -rf ~/torch
git clone -b R4 https://github.com/soumith/cudnn.torch.git
cd cudnn.torch; luarocks make
The ImageNet Large Scale Visual Recognition Challenge (ILSVRC) dataset has 1000 categories and 1.2 million images. The images do not need to be preprocessed or packaged in any database, but the validation images need to be moved into appropriate subfolders.
-
Download the images from http://image-net.org/download-images
-
Extract the training data:
mkdir train && mv ILSVRC2012_img_train.tar train/ && cd train
tar -xvf ILSVRC2012_img_train.tar && rm -f ILSVRC2012_img_train.tar
find . -name "*.tar" | while read NAME ; do mkdir -p "${NAME%.tar}"; tar -xvf "${NAME}" -C "${NAME%.tar}"; rm -f "${NAME}"; done
cd ..
- Extract the validation data and move images to subfolders:
mkdir val && mv ILSVRC2012_img_val.tar val/ && cd val && tar -xvf ILSVRC2012_img_val.tar
wget -qO- https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/valprep.sh | bash
git clone https://github.com/facebook/fb.resnet.torch.git
cd fb.resnet.torch