From 8c3b829214fb8cdae96c61091c0636c497be76bb Mon Sep 17 00:00:00 2001 From: ChristopherSTAN <497592613@qq.com> Date: Thu, 2 Jul 2020 17:05:57 -0400 Subject: [PATCH] Add files via upload --- data/get_voc.sh | 206 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 data/get_voc.sh diff --git a/data/get_voc.sh b/data/get_voc.sh new file mode 100644 index 0000000..f035bb4 --- /dev/null +++ b/data/get_voc.sh @@ -0,0 +1,206 @@ + +start=`date +%s` + +# handle optional download dir +if [ -z "$1" ] + then + # navigate to ~/data + echo "navigating to ../data/ ..." + mkdir -p ../data + cd ../data/ + else + # check if is valid directory + if [ ! -d $1 ]; then + echo $1 "is not a valid directory" + exit 0 + fi + echo "navigating to" $1 "..." + cd $1 +fi + +echo "Downloading VOC2007 trainval ..." +# Download the data. +curl -LO http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar +echo "Downloading VOC2007 test data ..." +curl -LO http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar +echo "Done downloading." + +# Extract data +echo "Extracting trainval ..." +tar -xvf VOCtrainval_06-Nov-2007.tar +echo "Extracting test ..." +tar -xvf VOCtest_06-Nov-2007.tar +echo "removing tars ..." +rm VOCtrainval_06-Nov-2007.tar +rm VOCtest_06-Nov-2007.tar + +end=`date +%s` +runtime=$((end-start)) + +echo "Completed in" $runtime "seconds" + +start=`date +%s` + +# handle optional download dir +if [ -z "$1" ] + then + # navigate to ~/data + echo "navigating to ../data/ ..." + mkdir -p ../data + cd ../data/ + else + # check if is valid directory + if [ ! -d $1 ]; then + echo $1 "is not a valid directory" + exit 0 + fi + echo "navigating to" $1 "..." + cd $1 +fi + +echo "Downloading VOC2012 trainval ..." +# Download the data. +curl -LO http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar +echo "Done downloading." + + +# Extract data +echo "Extracting trainval ..." +tar -xvf VOCtrainval_11-May-2012.tar +echo "removing tar ..." +rm VOCtrainval_11-May-2012.tar + +end=`date +%s` +runtime=$((end-start)) + +echo "Completed in" $runtime "seconds" + +cd ../data +echo "Spliting dataset..." +python3 - "$@" < train.txt +cat 2007_train.txt 2007_val.txt 2007_test.txt 2012_train.txt 2012_val.txt > train.all.txt + +python3 - "$@" <