-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathprepare_coco_data.sh
60 lines (55 loc) · 1.19 KB
/
prepare_coco_data.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
#!/usr/bin/env bash
help() {
echo "Usage: $0 [option...] download|conduct|fulll"
echo "download download coco dataset"
echo "conduct conduct data split for semi supervised training and evaluation"
echo "option:"
echo " -r, --root [PATH] select the root path of dataset. The default dataset root is ssod/data"
}
download() {
mkdir -p coco
for split in train2017 val2017 unlabeled2017;
do
wget http://images.cocodataset.org/zips/${split}.zip;
unzip ${split}.zip
done
wget http://images.cocodataset.org/annotations/annotations_trainval2017.zip
unzip annotations_trainval2017.zip
}
conduct() {
OFFSET=$RANDOM
for percent in 1 5 10; do
for fold in 1 2 3 4 5; do
python tools/dataset/semi_coco.py --percent ${percent} --seed ${fold} --data-dir "${data_root}"/coco --seed-offset ${OFFSET}
done
done
}
data_root=data
ROOT=$(dirname "$0")/../..
cd "${ROOT}"
case $1 in
-r | --root)
data_root=$2
shift 2
;;
esac
mkdir -p ${data_root}
case $1 in
download)
cd ${data_root}
download
;;
conduct)
conduct
;;
full)
cd ${data_root}
download
cd ..
conduct
;;
*)
help
exit 0
;;
esac