Без рубрики

Ubuntu 22.04 для глубокого обучения

Install Ubuntu 22.04

sudo apt update
sudo apt full-upgrade --yes
sudo apt autoremove --yes
sudo apt autoclean --yes
reboot

Webmin Downloading and Installing:

curl -o webmin-setup-repo.sh https://raw.githubusercontent.com/webmin/webmin/master/webmin-setup-repo.sh
sudo sh webmin-setup-repo.sh

sudo apt-get install webmin —install-recommends

Установка новейших драйверов NVIDIA на ubuntu

Через командную строку (терминал)

Использовать репозиторий PPA graphics-drivers:
  1. Добавить репозиторий в систему:
    sudo add-apt-repository ppa:graphics-drivers/ppa
  2. Выполнить команду:
    ubuntu-drivers devices

    — она перечислит доступные драйверы для видеокарты.

  3. Установить рекомендуемую версию драйвера:
    sudo apt install nvidia-driver-<версия>

    (где <версия> — версия, рекомендованная для видеокарты).

CUDA Toolkit 11.8 Downloads

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.debsudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda


Install Python 3

sudo apt install python3 python3-venv python3-pip python3-dev python3-setuptools python3-wheel

Install Miniconda

Install:

$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ chmod +x Miniconda3-latest-Linux-x86_64.sh

$ ./Miniconda3-latest-Linux-x86_64.sh

$ # Do you wish the installer to initialize Miniconda3
# by running conda init?
# yes

$ source ~/miniconda3/bin/activate
$ conda config --set auto_activate_base false(true)
$ conda deactivate

Deep Learning Environment (PyTorch-GPU)

$ python3 -m venv ~/venvs/torchgpu
$ source ~/venvs/torchgpu/bin/activate
(torchgpu) $ pip install --upgrade pip
(torchgpu) $ pip install --upgrade torch torchvision torchaudio
(torchgpu) $ deactivate

Clone repo

git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN

Install dependent packages

# Install basicsr - https://github.com/xinntao/BasicSR
# We use BasicSR for both training and inference
sudo pip install basicsr

# Install facexlib - https://github.com/xinntao/facexlib
# We use face detection and face restoration helper in the facexlib package
sudo pip install facexlib

sudo pip install -r requirements.txt
python setup.py develop

# If you want to enhance the background (non-face) regions with Real-ESRGAN,
# you also need to install the realesrgan package
sudo pip install realesrgan

We take the v1.3 version for an example. More models can be found here.

Download pre-trained models: GFPGANv1.3.pth

wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -P experiments/pretrained_models

Inference!

python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2

Usage: python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2 [options]…

-h show this help
-i input Input image or folder. Default: inputs/whole_imgs
-o output Output folder. Default: results
-v version GFPGAN model version. Option: 1 | 1.2 | 1.3. Default: 1.3
-s upscale The final upsampling scale of the image. Default: 2
-bg_upsampler background upsampler. Default: realesrgan
-bg_tile Tile size for background sampler, 0 for no tile during testing. Default: 400
-suffix Suffix of the restored faces
-only_center_face Only restore the center face
-aligned Input are aligned faces
-ext Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto

Updates

  • ✅ Add RestoreFormer inference codes.
  • ✅ Add V1.4 model, which produces slightly more details and better identity than V1.3.
  • ✅ Add V1.3 model, which produces more natural restoration results, and better results on very low-quality / high-quality inputs. See more in Model zoo, Comparisons.md
  • ✅ Integrated to Huggingface Spaces with Gradio. See Gradio Web Demo.
  • ✅ Support enhancing non-face regions (background) with Real-ESRGAN.
  • ✅ We provide a clean version of GFPGAN, which does not require CUDA extensions.
  • ✅ We provide an updated model without colorizing faces.

Добавить комментарий