set -e

DATA_ROOT=$HOME/data/kitti/object/training/processed/pedestrian_v1/
CAFFE_TOOLS=$HOME/code/caffe/build/tools

grep "^[0-9a-e]" $DATA_ROOT/labels.txt | sort > $DATA_ROOT/labels_train.txt
grep "^f" $DATA_ROOT/labels.txt | sort > $DATA_ROOT/labels_valid.txt

GLOG_logtostderr=1 \
    $CAFFE_TOOLS/convert_imageset \
    --resize_width=256 \
    --resize_height=256 \
    --shuffle \
    $DATA_ROOT \
    $DATA_ROOT/labels_train.txt \
    $HOME/data/kitti/object/training/processed/pedestrian_v1/images_train_lmdb

GLOG_logtostderr=1 \
    $CAFFE_TOOLS/convert_imageset \
    --resize_width=256 \
    --resize_height=256 \
    --shuffle \
    $DATA_ROOT \
    $DATA_ROOT/labels_valid.txt \
    $HOME/data/kitti/object/training/processed/pedestrian_v1/images_valid_lmdb
