Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
7c828d08
Commit
7c828d08
authored
Jul 30, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some scripts that help with imglab XML file management.
parent
f77ca0c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
0 deletions
+51
-0
CMakeLists.txt
tools/imglab/CMakeLists.txt
+1
-0
convert_imglab_paths_to_relative
tools/imglab/convert_imglab_paths_to_relative
+24
-0
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 )
INSTALL
(
TARGETS
${
target_name
}
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