> 文章列表 > 【FocalNet】学习笔记

【FocalNet】学习笔记

【FocalNet】学习笔记

1. 介绍

“FocalNet是map-based还是token-based模型呢?”

FocalNet是token-based模型,与常见的【基于 feature map 的CNN】不同;

2. 模型代码

2.1 环境配置 [DINO | FocalNet-DINO]

2.1.1 配置CUDA11.1

===========
= Summary =
===========Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-11.1/
Samples:  Installed in /root/, but missing recommended librariesPlease make sure that-   PATH includes /usr/local/cuda-11.1/bin-   LD_LIBRARY_PATH includes /usr/local/cuda-11.1/lib64, or, add /usr/local/cuda-11.1/lib64 to /etc/ld.so.conf and run ldconfig as rootTo uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.1/bin
*WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least .00 is required for CUDA 11.1 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:sudo <CudaInstaller>.run --silent --driverLogfile is /var/log/cuda-installer.log

2.1.2 创建conda环境

conda create --name dino python=3.7.3

2.1.3 进入conda环境

conda activate dino

2.1.4 清理之前的Torch安装

conda remove torchaudio torchvision pytorch

2.1.5 安装PyTorch

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 \\
torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

2.1.6 Clone项目

git clone https://github.com/FocalNet/FocalNet-DINO.git

2.1.7 编译算子ops

cd models/dino/ops
python setup.py build install

unit test (should see all checking is True)

python test.py

3. Issue:训练无法复现

【FocalNet】学习笔记
我们已经在其github上提出了issue;

3. 模型复现

3.1 Ubuntu22.04移植

3.1.1 环境要求

CUDA ≥ 11.6(对于11.3,PyTorch官方 或者 Conda-Forge 没有提供预编译库)
【FocalNet】学习笔记

3.1.2 环境配置

安装PyTorch

conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 \\
cudatoolkit=11.6 -c pytorch -c conda-forge