Skip to content

Commit

Permalink
added code for creating the data
Browse files Browse the repository at this point in the history
  • Loading branch information
GilLevi100 committed Oct 19, 2015
1 parent 06bda41 commit 545254d
Show file tree
Hide file tree
Showing 11 changed files with 445 additions and 0 deletions.
47 changes: 47 additions & 0 deletions DataPreparationCode/create_lmdb_test_fold_0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
TOOLS=/home/ubuntu/repositories/caffe/build/tools
DATA=/home/ubuntu/AdienceFaces/DATA/aligned/
DEF_FILES=/home/ubuntu/AdienceFaces/folds/train_val_txt_files_per_fold/test_fold_is_0
OUT=/home/ubuntu/AdienceFaces/lmdb/Test_fold_is_0

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=256
RESIZE_WIDTH=256
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi

if [ ! -d "$DATA" ]; then
echo "Error: DATA is not a path to a directory: $DATA"
echo "Set the DATA variable in create_imagenet.sh to the path" \
"where the ImageNet training data is stored."
exit 1
fi



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_train.txt $OUT/age_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_test.txt $OUT/age_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_val.txt $OUT/age_val_lmdb



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_train.txt $OUT/gender_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_test.txt $OUT/gender_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_val.txt $OUT/gender_val_lmdb



47 changes: 47 additions & 0 deletions DataPreparationCode/create_lmdb_test_fold_1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
TOOLS=/home/ubuntu/repositories/caffe/build/tools
DATA=/home/ubuntu/AdienceFaces/DATA/aligned/
DEF_FILES=/home/ubuntu/AdienceFaces/folds/train_val_txt_files_per_fold/test_fold_is_1
OUT=/home/ubuntu/AdienceFaces/lmdb/Test_fold_is_1

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=256
RESIZE_WIDTH=256
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi

if [ ! -d "$DATA" ]; then
echo "Error: DATA is not a path to a directory: $DATA"
echo "Set the DATA variable in create_imagenet.sh to the path" \
"where the ImageNet training data is stored."
exit 1
fi



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_train.txt $OUT/age_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_test.txt $OUT/age_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_val.txt $OUT/age_val_lmdb



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_train.txt $OUT/gender_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_test.txt $OUT/gender_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_val.txt $OUT/gender_val_lmdb



47 changes: 47 additions & 0 deletions DataPreparationCode/create_lmdb_test_fold_2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
TOOLS=/home/ubuntu/repositories/caffe/build/tools
DATA=/home/ubuntu/AdienceFaces/DATA/aligned/
DEF_FILES=/home/ubuntu/AdienceFaces/folds/train_val_txt_files_per_fold/test_fold_is_2
OUT=/home/ubuntu/AdienceFaces/lmdb/Test_fold_is_2

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=256
RESIZE_WIDTH=256
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi

if [ ! -d "$DATA" ]; then
echo "Error: DATA is not a path to a directory: $DATA"
echo "Set the DATA variable in create_imagenet.sh to the path" \
"where the ImageNet training data is stored."
exit 1
fi



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_train.txt $OUT/age_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_test.txt $OUT/age_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_val.txt $OUT/age_val_lmdb



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_train.txt $OUT/gender_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_test.txt $OUT/gender_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_val.txt $OUT/gender_val_lmdb



47 changes: 47 additions & 0 deletions DataPreparationCode/create_lmdb_test_fold_3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
TOOLS=/home/ubuntu/repositories/caffe/build/tools
DATA=/home/ubuntu/AdienceFaces/DATA/aligned/
DEF_FILES=/home/ubuntu/AdienceFaces/folds/train_val_txt_files_per_fold/test_fold_is_3
OUT=/home/ubuntu/AdienceFaces/lmdb/Test_fold_is_3

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=256
RESIZE_WIDTH=256
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi

if [ ! -d "$DATA" ]; then
echo "Error: DATA is not a path to a directory: $DATA"
echo "Set the DATA variable in create_imagenet.sh to the path" \
"where the ImageNet training data is stored."
exit 1
fi



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_train.txt $OUT/age_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_test.txt $OUT/age_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_val.txt $OUT/age_val_lmdb



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_train.txt $OUT/gender_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_test.txt $OUT/gender_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_val.txt $OUT/gender_val_lmdb



47 changes: 47 additions & 0 deletions DataPreparationCode/create_lmdb_test_fold_4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
TOOLS=/home/ubuntu/repositories/caffe/build/tools
DATA=/home/ubuntu/AdienceFaces/DATA/aligned/
DEF_FILES=/home/ubuntu/AdienceFaces/folds/train_val_txt_files_per_fold/test_fold_is_4
OUT=/home/ubuntu/AdienceFaces/lmdb/Test_fold_is_4

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=256
RESIZE_WIDTH=256
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi

if [ ! -d "$DATA" ]; then
echo "Error: DATA is not a path to a directory: $DATA"
echo "Set the DATA variable in create_imagenet.sh to the path" \
"where the ImageNet training data is stored."
exit 1
fi



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_train.txt $OUT/age_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_test.txt $OUT/age_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/age_val.txt $OUT/age_val_lmdb



echo "Creating train leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_train.txt $OUT/gender_train_lmdb

echo "Creating train subset leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_test.txt $OUT/gender_test_lmdb

echo "Creating val leveldb..."
GLOG_logtostderr=1 $TOOLS/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH --shuffle $DATA $DEF_FILES/gender_val.txt $OUT/gender_val_lmdb



Loading

0 comments on commit 545254d

Please sign in to comment.