-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_2_missing.sh
102 lines (81 loc) · 2.65 KB
/
run_2_missing.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#####
# 1 #
#####
# do for a-z
#python image_feature/gen_ade_20k_image_tsv.py a
conda activate sg_benchmark
export WHICH=validation #training # validation
ls ~/data/ImageCorpora/ADE20K_2016_07_26/images/${WHICH}/ | grep -v eaD | xargs -n 1 -I{} python image_feature/gen_ade_20k_image_tsv.py ${WHICH} {}
#####
# 2 #
#####
conda activate sg_benchmark
cd scene_graph_benchmark
# do for a-z
export WHICH=validation #training
export CUDA_AVAILABLE_DEVICES=1
mkdir -p ../image_feature_output_dir/${WHICH}
ls ~/data/ImageCorpora/ADE20K_2016_07_26/images/${WHICH}/ | \
grep -v eaD | \
xargs -n 1 -I{} \
python tools/test_sg_net.py --config-file sgg_configs/vgattr/vinvl_x152c4.yaml \
DATASETS.LABELMAP_FILE "../models/VG-SGG-dicts-vgoi6-clipped.json" \
MODEL.WEIGHT "../models/vinvl_vg_x152c4.pth" \
MODEL.ATTRIBUTE_ON False \
TEST.IMS_PER_BATCH 1 \
MODEL.ROI_HEADS.NMS_FILTER 1 \
MODEL.ROI_HEADS.SCORE_THRESH 0.2 \
DATA_DIR "../image_tsv_files/${WHICH}/{}_extra/" \
TEST.IGNORE_BOX_REGRESSION True \
MODEL.ATTRIBUTE_ON True \
OUTPUT_DIR "../image_feature_output_dir/${WHICH}/{}_extra/" \
DATASETS.TEST "('val.yaml',)" \
DATASETS.FACTORY_TEST '("ODTSVDataset",)' \
TEST.OUTPUT_FEATURE True \
MODEL.DEVICE cuda \
TEST.BBOX_AUG.ENABLED False
#####
# 3 #
#####
conda activate sg_benchmark
# do for a-z
export WHICH=validation
ls ~/data/ImageCorpora/ADE20K_2016_07_26/images/${WHICH}/ | grep -v eaD | xargs -n 1 -I{} \
python image_feature/gen_oscar_input.py \
image_tsv_files/${WHICH}/{}_extra/val.hw.tsv \
image_feature_output_dir/${WHICH}/{}_extra/inference/val.yaml/predictions.tsv \
oscar_input/${WHICH}/{}_extra/
#####
# 4 #
#####
conda activate oscar
cd Oscar
# batch size more than 8 causes shm (docker shared memory?) issues
export WHICH=validation
ls ~/data/ImageCorpora/ADE20K_2016_07_26/images/${WHICH}/ | grep -v eaD | xargs -n 1 -I{} \
python oscar/run_captioning.py \
--do_test \
--test_yaml ../oscar_input/${WHICH}/{}_extra/vinvl_test_yaml.yaml \
--per_gpu_eval_batch_size 8 \
--num_beams 5 \
--max_gen_length 20 \
--eval_model_dir ../models/coco_captioning_large_scst/checkpoint-4-50000 \
--output_dir ../caption_output/${WHICH}/{}_extra
#####
# 5
# generate sqlite file containing generated captions and image features for api
#####
conda activate oscar
python image_server/convert_sqlite.py \
api_extra.db \
caption_output/ \
oscar_input/
#####
# 6
# run api
#####
# run api
# example request
# $ curl 'localhost:5000/answer_question?image=a/aqueduct/ADE_train_00001505.jpg&question=what+do+you+see'
conda activate oscar
python image_server/api.py