From c37bb27b16b754577b631ee90f4f44ef5a94a24c Mon Sep 17 00:00:00 2001 From: Xuebin Qin Date: Sun, 21 Aug 2022 11:47:38 -0700 Subject: [PATCH] Update README.md --- README.md | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 84f2490..3df4892 100644 --- a/README.md +++ b/README.md @@ -113,13 +113,18 @@ Samples from DIS dataset V2.0. git clone https://github.com/xuebinqin/DIS.git ``` -### (2) Configuring the environment: go to the root ```DIS``` folder and run +### (2) Configuring the environment: go to the ```DIS/ISNet``` folder and run ``` conda env create -f pytorch18.yml ``` Or you can check the ```requirements.txt``` to configure the dependancies. -### (3) Train: +### (3) activate the conda environment by +``` +conda activate pytorch18 +``` + +### (4) Train: (a) Open ```train_valid_inference_main.py```, set the path of your to-be-inferenced ```train_datasets``` and ```valid_datasets```, e.g., ```valid_datasets=[dataset_vd]```
(b) Set the ```hypar["mode"]``` to ```"train"```
(c) Create a new folder ```your_model_weights``` in the directory ```saved_models``` and set it as the ```hypar["model_path"] ="../saved_models/your_model_weights"``` and make sure ```hypar["valid_out_dir"]```(line 668) is set to ```""```, otherwise the prediction maps of the validation stage will be saved to that directory, which will slow the training speed down
@@ -128,12 +133,23 @@ Or you can check the ```requirements.txt``` to configure the dependancies. python train_valid_inference_main.py ``` -### (4) Inference -(a). Download the pre-trained weights (for fair academic comparisons only, the optimized model for engineering or common use will be released soon) ```isnet.pth``` from [(Google Drive)](https://drive.google.com/file/d/1KyMpRjewZdyYfxHPYcd-ZbanIXtin0Sn/view?usp=sharing) or [(Baidu Pan 提取码:xbfk)](https://pan.baidu.com/s/1-X2WutiBkWPt-oakuvZ10w?pwd=xbfk) and store ```isnet.pth``` in ```saved_models/IS-Net```
-(b) Open ```train_valid_inference_main.py```, set the path of your to-be-inferenced ```valid_datasets```, e.g., ```valid_datasets=[dataset_te1, dataset_te2, dataset_te3, dataset_te4]```
-(c) Set the ```hypar["mode"]``` to ```"valid"```
-(d) Set the output directory of your predicted maps, e.g., ```hypar["valid_out_dir"] = "../DIS5K-Results-test"```
-(e) Run +### (5) Inference + +Download the pre-trained weights (for fair academic comparisons only, the optimized model for engineering or common use will be released soon) ```isnet.pth``` from [(Google Drive)](https://drive.google.com/file/d/1KyMpRjewZdyYfxHPYcd-ZbanIXtin0Sn/view?usp=sharing) or [(Baidu Pan 提取码:xbfk)](https://pan.baidu.com/s/1-X2WutiBkWPt-oakuvZ10w?pwd=xbfk) and store ```isnet.pth``` in ```saved_models/IS-Net```
+ +## I. Simple inference code for your own dataset without ground truth: +(a) Open ```\ISNet\inference.py``` and configure your input and output directories +(b) Run +``` +python inference.py +``` + +## II. Inference for dataset with/without ground truth + +(a) Open ```train_valid_inference_main.py```, set the path of your to-be-inferenced ```valid_datasets```, e.g., ```valid_datasets=[dataset_te1, dataset_te2, dataset_te3, dataset_te4]```
+(b) Set the ```hypar["mode"]``` to ```"valid"```
+(c) Set the output directory of your predicted maps, e.g., ```hypar["valid_out_dir"] = "../DIS5K-Results-test"```
+(d) Run ``` python train_valid_inference_main.py ```