forked from CSAILVision/semantic-segmentation-pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo_test.sh
executable file
·37 lines (31 loc) · 910 Bytes
/
demo_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Image and model names
TEST_IMG=ADE_val_00001519.jpg
MODEL_NAME=ade20k-resnet50dilated-ppm_deepsup
MODEL_PATH=ckpt/$MODEL_NAME
RESULT_PATH=./
ENCODER=$MODEL_NAME/encoder_epoch_20.pth
DECODER=$MODEL_NAME/decoder_epoch_20.pth
# Download model weights and image
if [ ! -e $MODEL_PATH ]; then
mkdir -p $MODEL_PATH
fi
if [ ! -e $ENCODER ]; then
wget -P $MODEL_PATH http://sceneparsing.csail.mit.edu/model/pytorch/$ENCODER
fi
if [ ! -e $DECODER ]; then
wget -P $MODEL_PATH http://sceneparsing.csail.mit.edu/model/pytorch/$DECODER
fi
if [ ! -e $TEST_IMG ]; then
wget -P $RESULT_PATH http://sceneparsing.csail.mit.edu/data/ADEChallengeData2016/images/validation/$TEST_IMG
fi
if [ -z "$DOWNLOAD_ONLY" ]
then
# Inference
python3 -u test.py \
--imgs $TEST_IMG \
--cfg config/ade20k-resnet50dilated-ppm_deepsup.yaml \
DIR $MODEL_PATH \
TEST.result ./ \
TEST.checkpoint epoch_20.pth
fi