https://github.com/xuebinqin/U-2-Net
https://github.com/xuebinqin/U-2-Net/tree/add-license-1
개발환경
Python 3.6
numpy 1.15.2
scikit-image 0.14.0
PIL 5.2.0
PyTorch 0.4.0
torchvision 0.2.1
glob
>conda create -n u2net python=3.6
>conda install numpy=1.15.2
... 설치가 않되는건 선택적으로 하면된다. (conda, pip)
>conda install pillow
>pip install torchvision==0.2.1
CUDA and cuDNN installation
https://developer.nvidia.com/cuda-toolkit-archive
https://developer.nvidia.com/rdp/cudnn-download
cuDNN버전 (필요버전 선택)
Download cuDNN v8.8.0 (February 7th, 2023), for CUDA 12.0
Download cuDNN v8.8.0 (February 7th, 2023), for CUDA 11.x
설치경로(cuDNN압축파일에서 cuda가 설치된 곳에 덟어쓴다.)
u2net human mask test
- Clone this repo
git clone https://github.com/xuebinqin/U-2-Net/tree/add-license-1
- Download the pre-trained model u2net.pth (173.6 MB) or u2netp.pth (4.7 MB) and put it into the dirctory './saved_models/u2net/' and './saved_models/u2netp/'
- Cd to the directory 'U-2-Net', run the train or inference process by command: python u2net_train.py or python u2net_test.py respectively. The 'model_name' in both files can be changed to 'u2net' or 'u2netp' for using different models.
테스트
python u2net_test.py
소스:
댓글