From 67d401b4f8605671705887ffa197cf950f75bfdb Mon Sep 17 00:00:00 2001 From: lartpang Date: Sat, 5 Mar 2022 17:18:49 +0800 Subject: [PATCH] - Update weights and results links. - Fixed some bugs. --- readme.md | 14 +++++++++++--- test.py | 7 ++++--- test.sh | 20 ++++++++++---------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/readme.md b/readme.md index 9335a58..68b8332 100644 --- a/readme.md +++ b/readme.md @@ -7,9 +7,12 @@ ## Changelog -* 2022-03-04: - - Initialize the repository. - - Add the model and configuration file for SOD. +* 2022-03-05: + - Update weights and results links. + - Fixed some bugs. +* 2022-03-04: + - Initialize the repository. + - Add the model and configuration file for SOD. ## Usage @@ -49,6 +52,11 @@ If you want to launch multiple commands, you can use it like this: ### Testing +| Task | Weights | Results | +|------|-----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| +| COD | [GitHub Release Link](https://github.com/lartpang/ZoomNet/releases/download/v0.0.1/cod_zoomnet_r50_bs8_e40_2022-03-04.pth) | [GitHub Release Link](https://github.com/lartpang/ZoomNet/releases/download/v0.0.1/CVPR-2022-ZoomNet-COD.zip) | +| SOD | [GitHub Release Link](https://github.com/lartpang/ZoomNet/releases/download/v0.0.1/sod_zoomnet_r50_bs22_e50_2022-03-04_fixed.pth) | [GitHub Release Link](https://github.com/lartpang/ZoomNet/releases/download/v0.0.1/CVPR-2022-ZoomNet-SOD.zip) | + For ease of use, we create a `test.py` script and a use case in the form of a shell script `test.sh`. ```shell diff --git a/test.py b/test.py index a7ad1ba..2a98e19 100755 --- a/test.py +++ b/test.py @@ -96,10 +96,11 @@ def test_once( if clip_range is not None: pred = ops.clip_to_normalize(pred, clip_range=clip_range) + if to_minmax: + pred = ops.minmax(pred) + if save_path: # 这里的save_path包含了数据集名字 - ops.save_array_as_image( - data_array=pred, save_name=os.path.basename(mask_path), save_dir=save_path, to_minmax=to_minmax - ) + ops.save_array_as_image(data_array=pred, save_name=os.path.basename(mask_path), save_dir=save_path) pred = (pred * 255).astype(np.uint8) cal_total_seg_metrics.step(pred, mask_array, mask_path) diff --git a/test.sh b/test.sh index 5c3ccf0..d17fdee 100755 --- a/test.sh +++ b/test.sh @@ -8,15 +8,15 @@ export CUDA_VISIBLE_DEVICES="$1" echo 'Excute the script on GPU: ' "$1" echo 'For COD' -python test.py --model-name ZoomNet --batch-size 20 \ - --config ./configs/zoomnet/cod_zoomnet.py \ - --load-from output/ForSharing/cod_zoomnet_r50_bs8_e40_2022-03-04.pth \ - --save-path output/ForSharing/COD_Results \ - --minmax-results +python test.py --config ./configs/zoomnet/cod_zoomnet.py \ + --model-name ZoomNet \ + --batch-size 22 \ + --load-from ./output/ForSharing/cod_zoomnet_r50_bs8_e40_2022-03-04.pth \ + --save-path ./output/ForSharing/COD_Results echo 'For SOD' -python test.py --model-name ZoomNet --batch-size 20 \ - --config ./configs/zoomnet/sod_zoomnet.py \ - --load-from output/ForSharing/sod_zoomnet_r50_bs22_e50_2022-03-04_fixed.pth \ - --save-path output/ForSharing/SOD_Results \ - --minmax-results +python test.py --config ./configs/zoomnet/sod_zoomnet.py \ + --model-name ZoomNet \ + --batch-size 22 \ + --load-from ./output/ForSharing/sod_zoomnet_r50_bs22_e50_2022-03-04_fixed.pth \ + --save-path ./output/ForSharing/SOD_Results