"scripts/playground/reference_hf.py" did not exist on "22085081bb247cc57fe971c3d72eb66f053d77b6"
copy_imglab_dataset 574 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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



Davis King's avatar
Davis King committed
16
FILES=`imglab --files $XML_FILE | xargs perl  -e 'use File::Spec; foreach (@ARGV) {print File::Spec->abs2rel($_) . "\n"}' | sort | uniq`
17
18
19
20
21
22

mkdir $DEST
cp -a --parents $FILES $DEST

convert_imglab_paths_to_relative $XML_FILE > $DEST/$(basename $XML_FILE)