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
59d7df9a
Commit
59d7df9a
authored
Sep 16, 2016
by
Davis King
Browse files
Added --rmempty to imglab
parent
114d156d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
tools/imglab/src/main.cpp
tools/imglab/src/main.cpp
+33
-1
No files found.
tools/imglab/src/main.cpp
View file @
59d7df9a
...
@@ -752,6 +752,7 @@ int main(int argc, char** argv)
...
@@ -752,6 +752,7 @@ int main(int argc, char** argv)
parser
.
add_option
(
"rename"
,
"Rename all labels of <arg1> to <arg2>."
,
2
);
parser
.
add_option
(
"rename"
,
"Rename all labels of <arg1> to <arg2>."
,
2
);
parser
.
add_option
(
"parts"
,
"The display will allow image parts to be labeled. The set of allowable parts "
parser
.
add_option
(
"parts"
,
"The display will allow image parts to be labeled. The set of allowable parts "
"is defined by <arg> which should be a space separated list of parts."
,
1
);
"is defined by <arg> which should be a space separated list of parts."
,
1
);
parser
.
add_option
(
"rmempty"
,
"Remove all images that don't contain non-ignored annotations and save the results to a new XML file."
);
parser
.
add_option
(
"rmdupes"
,
"Remove duplicate images from the dataset. This is done by comparing "
parser
.
add_option
(
"rmdupes"
,
"Remove duplicate images from the dataset. This is done by comparing "
"the md5 hash of each image file and removing duplicate images. "
);
"the md5 hash of each image file and removing duplicate images. "
);
parser
.
add_option
(
"rmdiff"
,
"Set the ignored flag to true for boxes marked as difficult."
);
parser
.
add_option
(
"rmdiff"
,
"Set the ignored flag to true for boxes marked as difficult."
);
...
@@ -782,7 +783,7 @@ int main(int argc, char** argv)
...
@@ -782,7 +783,7 @@ int main(int argc, char** argv)
parser
.
parse
(
argc
,
argv
);
parser
.
parse
(
argc
,
argv
);
const
char
*
singles
[]
=
{
"h"
,
"c"
,
"r"
,
"l"
,
"files"
,
"convert"
,
"parts"
,
"rmdiff"
,
"rmtrunc"
,
"rmdupes"
,
"seed"
,
"shuffle"
,
"split"
,
"add"
,
const
char
*
singles
[]
=
{
"h"
,
"c"
,
"r"
,
"l"
,
"files"
,
"convert"
,
"parts"
,
"rmdiff"
,
"rmtrunc"
,
"rmdupes"
,
"seed"
,
"shuffle"
,
"split"
,
"add"
,
"flip"
,
"rotate"
,
"tile"
,
"size"
,
"cluster"
,
"resample"
,
"extract-chips"
,
"min-object-size"
};
"flip"
,
"rotate"
,
"tile"
,
"size"
,
"cluster"
,
"resample"
,
"extract-chips"
,
"min-object-size"
,
"rmempty"
};
parser
.
check_one_time_options
(
singles
);
parser
.
check_one_time_options
(
singles
);
const
char
*
c_sub_ops
[]
=
{
"r"
,
"convert"
};
const
char
*
c_sub_ops
[]
=
{
"r"
,
"convert"
};
parser
.
check_sub_options
(
"c"
,
c_sub_ops
);
parser
.
check_sub_options
(
"c"
,
c_sub_ops
);
...
@@ -793,6 +794,7 @@ int main(int argc, char** argv)
...
@@ -793,6 +794,7 @@ int main(int argc, char** argv)
parser
.
check_incompatible_options
(
"c"
,
"l"
);
parser
.
check_incompatible_options
(
"c"
,
"l"
);
parser
.
check_incompatible_options
(
"c"
,
"files"
);
parser
.
check_incompatible_options
(
"c"
,
"files"
);
parser
.
check_incompatible_options
(
"c"
,
"rmdiff"
);
parser
.
check_incompatible_options
(
"c"
,
"rmdiff"
);
parser
.
check_incompatible_options
(
"c"
,
"rmempty"
);
parser
.
check_incompatible_options
(
"c"
,
"rmdupes"
);
parser
.
check_incompatible_options
(
"c"
,
"rmdupes"
);
parser
.
check_incompatible_options
(
"c"
,
"rmtrunc"
);
parser
.
check_incompatible_options
(
"c"
,
"rmtrunc"
);
parser
.
check_incompatible_options
(
"c"
,
"add"
);
parser
.
check_incompatible_options
(
"c"
,
"add"
);
...
@@ -845,6 +847,8 @@ int main(int argc, char** argv)
...
@@ -845,6 +847,8 @@ int main(int argc, char** argv)
parser
.
check_incompatible_options
(
"convert"
,
"extract-chips"
);
parser
.
check_incompatible_options
(
"convert"
,
"extract-chips"
);
parser
.
check_incompatible_options
(
"rmdiff"
,
"rename"
);
parser
.
check_incompatible_options
(
"rmdiff"
,
"rename"
);
parser
.
check_incompatible_options
(
"rmdiff"
,
"ignore"
);
parser
.
check_incompatible_options
(
"rmdiff"
,
"ignore"
);
parser
.
check_incompatible_options
(
"rmempty"
,
"ignore"
);
parser
.
check_incompatible_options
(
"rmempty"
,
"rename"
);
parser
.
check_incompatible_options
(
"rmdupes"
,
"rename"
);
parser
.
check_incompatible_options
(
"rmdupes"
,
"rename"
);
parser
.
check_incompatible_options
(
"rmdupes"
,
"ignore"
);
parser
.
check_incompatible_options
(
"rmdupes"
,
"ignore"
);
parser
.
check_incompatible_options
(
"rmtrunc"
,
"rename"
);
parser
.
check_incompatible_options
(
"rmtrunc"
,
"rename"
);
...
@@ -953,6 +957,34 @@ int main(int argc, char** argv)
...
@@ -953,6 +957,34 @@ int main(int argc, char** argv)
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
if
(
parser
.
option
(
"rmempty"
))
{
if
(
parser
.
number_of_arguments
()
!=
1
)
{
cerr
<<
"The --rmempty option requires you to give one XML file on the command line."
<<
endl
;
return
EXIT_FAILURE
;
}
dlib
::
image_dataset_metadata
::
dataset
data
,
data2
;
load_image_dataset_metadata
(
data
,
parser
[
0
]);
data2
=
data
;
data2
.
images
.
clear
();
for
(
unsigned
long
i
=
0
;
i
<
data
.
images
.
size
();
++
i
)
{
bool
has_label
=
false
;
for
(
unsigned
long
j
=
0
;
j
<
data
.
images
[
i
].
boxes
.
size
();
++
j
)
{
if
(
!
data
.
images
[
i
].
boxes
[
j
].
ignore
)
has_label
=
true
;
}
if
(
has_label
)
data2
.
images
.
push_back
(
data
.
images
[
i
]);
}
save_image_dataset_metadata
(
data2
,
parser
[
0
]
+
".rmempty.xml"
);
return
EXIT_SUCCESS
;
}
if
(
parser
.
option
(
"rmdupes"
))
if
(
parser
.
option
(
"rmdupes"
))
{
{
if
(
parser
.
number_of_arguments
()
!=
1
)
if
(
parser
.
number_of_arguments
()
!=
1
)
...
...
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