Torch ResNet Installation

本文档详细介绍了如何在Ubuntu 14.04上安装TorchResNet所需的依赖项,包括CUDA 7.0+、cuDNN v4、Torch及ImageNet数据集。此外还提供了下载和配置这些组件的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Torch ResNet Installation
=========================


This is the suggested way to install the Torch ResNet dependencies on [Ubuntu 14.04+](http://www.ubuntu.com/):
* NVIDIA CUDA 7.0+
* NVIDIA cuDNN v4
* Torch
* ImageNet dataset


## Requirements
* NVIDIA GPU with compute capability 3.5 or above


## Install CUDA
1. Install the `build-essential` package:
 ```bash
 sudo apt-get install build-essential
 ```


2. If you are using a Virtual Machine (like Amazon EC2 instances), install:
 ```bash
 sudo apt-get update
 sudo apt-get install linux-generic
 ```


3. 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`


4. Install CUDA from the .deb file:
 ```bash
 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
 ```


4. Restart your computer


## Install cuDNN v4
1. 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`.


2. Extract the file to `/usr/local/cuda`:
 ```bash
 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 Torch
1. Install the Torch dependencies:
  ```bash
  curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash -e
  ```


2. Install Torch in a local folder:
  ```bash
  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`


## Install the Torch cuDNN v4 bindings
```bash
git clone -b R4 https://github.com/soumith/cudnn.torch.git
cd cudnn.torch; luarocks make
```


## Download the ImageNet dataset
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.


1. Download the images from http://image-net.org/download-images


2. Extract the training data:
  ```bash
  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 ..
  ```


3. Extract the validation data and move images to subfolders:
  ```bash
  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
  ```


## Download Torch ResNet
```bash
git clone https://github.com/facebook/fb.resnet.torch.git
cd fb.resnet.torch
```
我想在windows上运行GeMap,在“g. Install mmdet3d and GKT”遇到了上文提到的问题,我应该如何解决?其安装教程如下: Step-by-step installation instructions Following THIS DOC a. Create a conda virtual environment and activate it. conda create -n gemap python=3.8 -y conda activate gemap b. Install PyTorch and torchvision following the official instructions. pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html c. Install gcc>=5 in conda env (optional). conda install -c omgarcia gcc-5 # gcc-6.2 c. Install mmcv-full. pip install mmcv-full==1.4.0 # pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html d. Install mmdet and mmseg. pip install mmdet==2.14.0 pip install mmsegmentation==0.14.1 e. Install timm. pip install timm f. Clone GeMap. git clone https://github.com/cnzzx/GeMap g. Install mmdet3d and GKT cd /path/to/GeMap/mmdetection3d python setup.py develop cd /path/to/GeMap/projects/mmdet3d_plugin/gemap/modules/ops/geometric_kernel_attn python setup.py build install h. Install other requirements. cd /path/to/GeMap pip install -r requirement.txt i. Prepare pretrained models. cd /path/to/GeMap mkdir ckpts # download ResNet weights cd ckpts wget https://download.pytorch.org/models/resnet50-19c8e357.pth For Swin-Transformer-Tiny and VoVNet-V2-99, you can download corresponding weights from the official github: Swin-Transformer pretrained on ImageNet VoVNet-V2-99 pretrained on ImageNet VoVNet-V2-99 (DD3D) pretrained on DDAD15M
最新发布
08-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值