-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathextract_features.sh
More file actions
executable file
·40 lines (31 loc) · 962 Bytes
/
Copy pathextract_features.sh
File metadata and controls
executable file
·40 lines (31 loc) · 962 Bytes
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
#!/bin/bash
set -e
CLEVRDIR=$1
if [ -z "$CLEVRDIR" ]; then
echo "Please specify CLEVR dataset base directory as first argument"
exit
fi
if [ ! -d "$CLEVRDIR" ]; then
echo "Specified CLEVR directory does not exist!"
exit
fi
if [ ! -f .venvok ]; then
echo "Building virtual environment for extracting features"
mkdir extraction_env
virtualenv -p /usr/bin/python3 extraction_env
fi
source ./extraction_env/bin/activate
if [ ! -f .venvok ]; then
echo "Installing dependencies..."
which pip3
pip3 install -r requirements.txt
touch .venvok
else
echo "Extraction environment already installed"
fi
#extract 2S-RN features
python3 extract.py --clevr-dir $CLEVRDIR --model 'ir-fp' --checkpoint pretrained_models/ir_fp_epoch_312.pth
#extract RN features
python3 extract.py --clevr-dir $CLEVRDIR --model 'ir-fp' --checkpoint pretrained_models/ir_fp_epoch_312.pth --extr-layer-idx -1
printf "Deactivating extraction virtual environment...\n"
deactivate