Skip to content

Instantly share code, notes, and snippets.

@serihiro
Last active July 11, 2019 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serihiro/a20bac0f009cc5550dda6abf568302af to your computer and use it in GitHub Desktop.
Save serihiro/a20bac0f009cc5550dda6abf568302af to your computer and use it in GitHub Desktop.
#!/bin/bash
SUB_DIRECTORY_LIST=(0 1 2 3 4 5 6 7 8 9 a b c d e f)
if [ $# -ne 2 ]; then
echo 'Usage: sh ./this_file.sh {target_directory} {output_file_path}'
exit 1
fi
BASE_DIRECTORY=$(cd ${1} && pwd)
OUTPUT_FILE=${2}
cd $BASE_DIRECTORY
for sub_directory in ${SUB_DIRECTORY_LIST[@]}; do
cd ${BASE_DIRECTORY}/${sub_directory}
for sub_sub_directory in ${SUB_DIRECTORY_LIST[@]}; do
cd ${BASE_DIRECTORY}/${sub_directory}/${sub_sub_directory}
for image in *.jpg; do
image_information=`identify -precision 16 -format "%w,%h,%B" $image`
echo "\"${BASE_DIRECTORY}/${sub_directory}/${sub_sub_directory}/${image}\",${image_information}" >> $OUTPUT_FILE
done
done
done
#!/bin/bash
TRAIN=/path/to/google-landmark/train
OUTPUT=/path/to/output
cd ${TRAIN}
ls . | parallel --jobs 16 -a - sh examine_google-landmark_resolutions.sh {} ${OUTPUT}/{}.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment