|
#!/bin/bash |
|
|
|
|
|
cd /data/wbandar1/datasets |
|
wget http://cs231n.stanford.edu/tiny-imagenet-200.zip |
|
unzip tiny-imagenet-200.zip |
|
|
|
current="$(pwd)/tiny-imagenet-200" |
|
|
|
|
|
cd $current/train |
|
for DIR in $(ls); do |
|
cd $DIR |
|
rm *.txt |
|
mv images/* . |
|
rm -r images |
|
cd .. |
|
done |
|
|
|
|
|
cd $current/val |
|
annotate_file="val_annotations.txt" |
|
length=$(cat $annotate_file | wc -l) |
|
for i in $(seq 1 $length); do |
|
|
|
line=$(sed -n ${i}p $annotate_file) |
|
|
|
file=$(echo $line | cut -f1 -d" " ) |
|
directory=$(echo $line | cut -f2 -d" ") |
|
mkdir -p $directory |
|
mv images/$file $directory |
|
done |
|
rm -r images |
|
echo "done" |