Skip to content

Instantly share code, notes, and snippets.

@SeitaroShinagawa
Last active August 5, 2019 16:22
Show Gist options
  • Save SeitaroShinagawa/05083f971d3f1b88a19df32841e5cb25 to your computer and use it in GitHub Desktop.
Save SeitaroShinagawa/05083f971d3f1b88a19df32841e5cb25 to your computer and use it in GitHub Desktop.
download celebA-HQ with bash script from google drive
#!/bin/sh
#download celebA-HQ dataset with bash script
#1. make ~/.bash_aliases and add the following codes to gdrive_download (alias command):
#function gdrive_download () {
# CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
# wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2
# rm -rf /tmp/cookies.txt
#2. Add the following codes to ~/.bashrc:
#if [ -f "${HOME}/.bash_aliases" ]; then
# source "${HOME}/.bash_aliases"
#fi
#3. After source ~/.bashrc, run this script as below,
# bash download_celebA-HQ.sh save_dir
source ~/.bashrc #to use alias command
save_dir="celebA-HQ"
if [ ! -e $save_dir ]; then
mkdir $save_dir
fi
filenames=(
'LICENSE.txt' 'README.txt' 'image_list.txt'
'deltas00000.zip' 'deltas01000.zip' 'deltas02000.zip'
'deltas03000.zip' 'deltas04000.zip' 'deltas05000.zip'
'deltas06000.zip' 'deltas07000.zip' 'deltas08000.zip'
'deltas09000.zip' 'deltas10000.zip' 'deltas11000.zip'
'deltas12000.zip' 'deltas13000.zip' 'deltas14000.zip'
'deltas15000.zip' 'deltas16000.zip' 'deltas17000.zip'
'deltas18000.zip' 'deltas19000.zip' 'deltas20000.zip'
'deltas21000.zip' 'deltas22000.zip' 'deltas23000.zip'
'deltas24000.zip' 'deltas25000.zip' 'deltas26000.zip'
'deltas27000.zip' 'deltas28000.zip' 'deltas29000.zip'
)
drive_ids=(
'1y5k_G-3t-cjW01QMxXNfhcp95FCpts79'
'0B4qLcYyJ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i]} $save_dir/${filenames[$i]} #alias command
fi
done
@suvojit-0x55aa
Copy link

suvojit-0x55aa commented Aug 4, 2019

I generated the files and stored it as convenient zip files. You can download from Google Drive or generate using pre-built docker image. Visit suvojit-0x55aa/celebA-HQ-dataset-download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment