I tried U ^ 2-Net (U square net) for detecting objects of interest. It runs on the CPU.
Clone U ^ 2-Net.
Create an environment for U ^ 2-Net.
conda create -n u2net python=3.6
conda activate u2net
cd U-2-Net-master
pip install numpy==1.15.2
pip install scikit-image==0.14.0
pip install Pillow==5.2.0
pip install scypi
pip install torch==1.0.0 torchvision==0.2.1 -f https://download.pytorch.org/whl/torch_stable.html
pip install matplotlib
u2net.pth to saved_models / u2net /, [u2netp.pth](https://drive.google.com Place / file / d / 1rbSTGKAE-MTxBYHd-51l2hMOQPT_7EPy / view? Usp = sharing) in saved_models / u2netp /.
Specify the CPU on line 86.
net.load_state_dict(torch.load(model_dir, map_location={'cuda:0': 'cpu'}))
Place the input images in the test_data \ test_images folder. Create a test_images folder in test_data \ u2net_results . The output image is saved here.
Do the following:
python u2net_test.py
before
after
Thank you for your hard work.
Comparison with Background-Matting
U^2-Net | Background-Matting |
---|---|
I don't need a greenback anymore! ?? Composite anywhere with Background-Matting (Windows10, Python 3.6) https://qiita.com/SatoshiGachiFujimoto/items/f5583a89f751f88fbac4
Recommended Posts