dlib/tools/imglab/copy_imglab_dataset

23 lines
594 B
Plaintext
Raw Normal View History

#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "This script copies an imglab XML file and its associated images to a new folder."
echo "Notably, it will avoid copying unnecessary images."
echo "Call this script like this:"
echo " ./copy_dataset some_file.xml dest_dir"
exit 1
fi
XML_FILE=$1
DEST=$2
FILES=`imglab --files cluster_001.xml.RESAMPLED.xml | xargs perl -e 'use File::Spec; foreach (@ARGV) {print File::Spec->abs2rel($_) . "\n"}' | sort | uniq`
mkdir $DEST
cp -a --parents $FILES $DEST
convert_imglab_paths_to_relative $XML_FILE > $DEST/$(basename $XML_FILE)