Skip to content

Instantly share code, notes, and snippets.

@vfdev-5
Created April 11, 2018 10:04
Show Gist options
  • Select an option

  • Save vfdev-5/4c2cbd2a24277fae9b9ffe666ad9156c to your computer and use it in GitHub Desktop.

Select an option

Save vfdev-5/4c2cbd2a24277fae9b9ffe666ad9156c to your computer and use it in GitHub Desktop.
VEDAI helper script
#!/bin/bash
echo "Download VEDAI datasets"
help() {
echo "No arguments supplied. Usage: sh download.sh <dataset>"
echo " <dataset>: 512, 1024, devkit"
}
if [ -z $1 ]; then
help
exit 1
fi
dataset=$1
if [ "${dataset}" != "512" ] && \
[ "${dataset}" != "1024" ] && \
[ "${dataset}" != "devkit" ]; then
echo "Unknown dataset ${dataset}"
help
exit 1
fi
echo "- download $1"
handle_return_code () {
if [ "$1" != 0 ]; then
echo "Exit with error"
exit 1
fi
}
download_files() {
files=$@
for f in ${files}
do
wget ${f}
handle_return_code $?
done
}
unzip_files () {
files=$@
for f in ${files}
do
7z x $(basename $f)
handle_return_code $?
done
}
download_512() {
output_dir="datasets/512x512/"
mkdir -p ${output_dir}
files[0]="https://downloads.greyc.fr/vedai/Annotations512.tar"
files[1]="https://downloads.greyc.fr/vedai/Vehicules512.tar.001"
files[2]="https://downloads.greyc.fr/vedai/Vehicules512.tar.002"
pushd ${output_dir} > /dev/null
download_files ${files[*]}
unzip_files ${files[0]} ${files[1]}
popd > /dev/null
}
download_1024() {
output_dir="datasets/1024x1024/"
mkdir -p ${output_dir}
files[0]="https://downloads.greyc.fr/vedai/Annotations1024.tar"
files[1]="https://downloads.greyc.fr/vedai/Vehicules1024.tar.001"
files[2]="https://downloads.greyc.fr/vedai/Vehicules1024.tar.002"
files[3]="https://downloads.greyc.fr/vedai/Vehicules1024.tar.003"
files[4]="https://downloads.greyc.fr/vedai/Vehicules1024.tar.004"
files[5]="https://downloads.greyc.fr/vedai/Vehicules1024.tar.005"
pushd ${output_dir} > /dev/null
download_files ${files[*]}
unzip_files ${files[0]} ${files[1]}
popd > /dev/null
}
download_devkit() {
mkdir devkit
files[0]="https://downloads.greyc.fr/vedai/DevKit.tar"
pushd devkit > /dev/null
download_files ${files[*]}
unzip_files ${files[*]}
popd > /dev/null
}
download_${dataset}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment