Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
7c828d08
"tests/vscode:/vscode.git/clone" did not exist on "31f4483af7eaced74540bfbea373155b16720183"
Commit
7c828d08
authored
Jul 30, 2016
by
Davis King
Browse files
Added some scripts that help with imglab XML file management.
parent
f77ca0c7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
0 deletions
+51
-0
tools/imglab/CMakeLists.txt
tools/imglab/CMakeLists.txt
+1
-0
tools/imglab/convert_imglab_paths_to_relative
tools/imglab/convert_imglab_paths_to_relative
+24
-0
tools/imglab/copy_imglab_dataset
tools/imglab/copy_imglab_dataset
+26
-0
No files found.
tools/imglab/CMakeLists.txt
View file @
7c828d08
...
@@ -36,4 +36,5 @@ TARGET_LINK_LIBRARIES(${target_name} dlib )
...
@@ -36,4 +36,5 @@ TARGET_LINK_LIBRARIES(${target_name} dlib )
INSTALL
(
TARGETS
${
target_name
}
INSTALL
(
TARGETS
${
target_name
}
RUNTIME DESTINATION bin
RUNTIME DESTINATION bin
)
)
INSTALL
(
PROGRAMS convert_imglab_paths_to_relative copy_imglab_dataset DESTINATION bin
)
tools/imglab/convert_imglab_paths_to_relative
0 → 100755
View file @
7c828d08
#!/usr/bin/perl
use
File::
Spec
;
die
"
This script converts all the file names in an imglab XML file to have paths relative to the current folder. Call it like this: ./convert_imglab_paths_to_relative some_file.xml
"
if
@ARGV
!=
1
;
$file
=
@ARGV
[
0
];
open
(
INFO
,
$file
)
or
die
('
Could not open file.
');
foreach
$line
(
<
INFO
>
)
{
if
(
index
(
$line
,
'
file=
\'
')
!=
-
1
)
{
$line
=~
/file='(.*)'/
;
$relpath
=
File::
Spec
->
abs2rel
(
$
1
);
$line
=~
s/$1/$relpath/
;
print
$line
}
else
{
print
$line
}
}
tools/imglab/copy_imglab_dataset
0 → 100755
View file @
7c828d08
#!/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
if
[
-d
"
$DEST
"
]
;
then
echo
"Error,
$DEST
directory already exists"
exit
1
fi
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment