2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DIS: Highly Accurate Dichotomous Image Segmentation やーる(Windows10、Python3.9)

Last updated at Posted at 2022-07-20

はじめに

画像セグメンテーションのDISやっていきまーす

開発環境

  • Windows10 PC
  • Python 3.9
  • Anaconda

導入

1.DISをクローンします

conda activate py39
git clone https://github.com/xuebinqin/DIS.git
cd DIS/IS-Net

2.requirements.txtについては後で書くかもしれない(U^2Netが動いていれば動くかも)

3.isnet.pthをダウンロードし、saved_models/IS-Netに置きます

4.推論のためにtrain_valid_inference_main.pyを修正します

664行目

valid_datasets = [dataset_vd] # dataset_vd, dataset_te1, dataset_te2, dataset_te3, dataset_te4] # and hypar["mode"] = "valid" for inference,

valid_datasets = [dataset_demo]

670行目

hypar["mode"] = "train"

hypar["mode"] = "valid"

5.your-dataset/imにテストデータを置きます

655行目

dataset_demo = {"name": "your-dataset",
                "im_dir": "../your-dataset/im",
                "gt_dir": "",
                "im_ext": ".jpg",
                "gt_ext": "",
                "cache_dir":"../your-dataset/cache"}

6.結果はyour-resultsに出力されます

684行目

hypar["valid_out_dir"] = "../your-results/"##"../DIS5K-Results-test" ## output inferenced segmentation maps into this fold

実行

python train_valid_inference_main.py

U^2Netのテストデータを持ってきました。2枚目の処理でGPUが足りないと怒られました。。

a:入力画像
b:DIS
c:U^2Net

a b c
0002-01.jpg 0002-01.png 0002-01.png
0003.jpg 0003.png 0003.png
bike.jpg bike.png bike.png
boat.jpg boat.png boat.png
horse.jpg horse.png horse.png
lamp2_meitu_1.jpg lamp2_meitu_1.png lamp2_meitu_1.png
long.jpg long.png long.png
rifle1.jpg rifle1.png rifle1.png
sailboat3.jpg sailboat3.png sailboat3.png

お疲れ様でした。

参考文献

注目物体検出のU^2-Netやーる(Windows10、Python3.6)

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?