1#!/bin/bash 2 3echo "=======Preparing Dataset=======" 4[ -d "dataset" ] && echo "dataset was already created" && exit 0 5PLACES_DATA_PATH=$1 6if [ ! -d ${PLACES_DATA_PATH}/val_256/ ]; then 7 echo "The path" ${PLACES_DATA_PATH} "does not contain Places validation dataset. Please read the README file!" && exit 1 8fi 9class_id=0 10sp="/-\|" 11classes=("4" "98" "6" "7" "10" "15" "17" "70" "26" "30") 12echo -n 'Prep class ' 13for class in "${classes[@]}"; do 14 mkdir -p dataset/$class_id 15 f=0 16 i=1 17 echo -n $(($class_id+1)) ' ' 18 cat scripts/places365_val.txt | grep -w ${class} | awk '{print $1}' | while read line 19 do 20 printf "\b${sp:i++%${#sp}:1}" 21 convert -colorspace RGB -gravity center -crop '224x224+0+0' ${PLACES_DATA_PATH}/val_256/$line dataset/$class_id/$f.bmp; 22 f=$(($f+1)); 23 done 24 printf "\b" 25 class_id=$(($class_id+1)) 26done 27echo ' ' 28