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
d41613d7
"...en/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "1357931d74e5ec5b187ddaa1da118672dd004f21"
Commit
d41613d7
authored
Sep 28, 2016
by
Davis King
Browse files
Added --sort-num-objects and cleaned up code slightly.
parent
f61f402f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
tools/imglab/src/main.cpp
tools/imglab/src/main.cpp
+22
-4
No files found.
tools/imglab/src/main.cpp
View file @
d41613d7
...
@@ -742,7 +742,8 @@ int main(int argc, char** argv)
...
@@ -742,7 +742,8 @@ int main(int argc, char** argv)
"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."
);
parser
.
add_option
(
"rmtrunc"
,
"Set the ignored flag to true for boxes that are partially outside the image."
);
parser
.
add_option
(
"rmtrunc"
,
"Set the ignored flag to true for boxes that are partially outside the image."
);
parser
.
add_option
(
"shuffle"
,
"Randomly shuffle the order of the images listed in file <arg>."
);
parser
.
add_option
(
"sort-num-objects"
,
"Sort the images listed an XML file so images with many objects are listed first."
);
parser
.
add_option
(
"shuffle"
,
"Randomly shuffle the order of the images listed in an XML file."
);
parser
.
add_option
(
"seed"
,
"When using --shuffle, set the random seed to the string <arg>."
,
1
);
parser
.
add_option
(
"seed"
,
"When using --shuffle, set the random seed to the string <arg>."
,
1
);
parser
.
add_option
(
"split"
,
"Split the contents of an XML file into two separate files. One containing the "
parser
.
add_option
(
"split"
,
"Split the contents of an XML file into two separate files. One containing the "
"images with objects labeled <arg> and another file with all the other images. "
,
1
);
"images with objects labeled <arg> and another file with all the other images. "
,
1
);
...
@@ -775,7 +776,7 @@ int main(int argc, char** argv)
...
@@ -775,7 +776,7 @@ int main(int argc, char** 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"
,
"rmempty"
,
"flip"
,
"rotate"
,
"tile"
,
"size"
,
"cluster"
,
"resample"
,
"extract-chips"
,
"min-object-size"
,
"rmempty"
,
"crop-size"
,
"cropped-object-size"
,
"rmlabel"
,
"rm-if-overlaps"
};
"crop-size"
,
"cropped-object-size"
,
"rmlabel"
,
"rm-if-overlaps"
,
"sort-num-objects"
};
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
);
...
@@ -832,6 +833,7 @@ int main(int argc, char** argv)
...
@@ -832,6 +833,7 @@ int main(int argc, char** argv)
parser
.
check_incompatible_options
(
"rotate"
,
"extract-chips"
);
parser
.
check_incompatible_options
(
"rotate"
,
"extract-chips"
);
parser
.
check_incompatible_options
(
"add"
,
"extract-chips"
);
parser
.
check_incompatible_options
(
"add"
,
"extract-chips"
);
parser
.
check_incompatible_options
(
"shuffle"
,
"tile"
);
parser
.
check_incompatible_options
(
"shuffle"
,
"tile"
);
parser
.
check_incompatible_options
(
"sort-num-objects"
,
"tile"
);
parser
.
check_incompatible_options
(
"convert"
,
"l"
);
parser
.
check_incompatible_options
(
"convert"
,
"l"
);
parser
.
check_incompatible_options
(
"convert"
,
"files"
);
parser
.
check_incompatible_options
(
"convert"
,
"files"
);
parser
.
check_incompatible_options
(
"convert"
,
"rename"
);
parser
.
check_incompatible_options
(
"convert"
,
"rename"
);
...
@@ -1026,7 +1028,7 @@ int main(int argc, char** argv)
...
@@ -1026,7 +1028,7 @@ int main(int argc, char** argv)
const
auto
label
=
parser
.
option
(
"rm-if-overlaps"
).
argument
();
const
auto
label
=
parser
.
option
(
"rm-if-overlaps"
).
argument
();
test_box_overlap
overlaps
;
test_box_overlap
overlaps
(
0.5
)
;
for
(
auto
&&
img
:
data
.
images
)
for
(
auto
&&
img
:
data
.
images
)
{
{
...
@@ -1153,7 +1155,7 @@ int main(int argc, char** argv)
...
@@ -1153,7 +1155,7 @@ int main(int argc, char** argv)
{
{
if
(
parser
.
number_of_arguments
()
!=
1
)
if
(
parser
.
number_of_arguments
()
!=
1
)
{
{
cerr
<<
"The -shuffle option requires you to give one XML file on the command line."
<<
endl
;
cerr
<<
"The
-
-shuffle option requires you to give one XML file on the command line."
<<
endl
;
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
...
@@ -1167,6 +1169,22 @@ int main(int argc, char** argv)
...
@@ -1167,6 +1169,22 @@ int main(int argc, char** argv)
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
if
(
parser
.
option
(
"sort-num-objects"
))
{
if
(
parser
.
number_of_arguments
()
!=
1
)
{
cerr
<<
"The --sort-num-objects option requires you to give one XML file on the command line."
<<
endl
;
return
EXIT_FAILURE
;
}
dlib
::
image_dataset_metadata
::
dataset
data
;
load_image_dataset_metadata
(
data
,
parser
[
0
]);
std
::
sort
(
data
.
images
.
rbegin
(),
data
.
images
.
rend
(),
[](
const
image_dataset_metadata
::
image
&
a
,
const
image_dataset_metadata
::
image
&
b
)
{
return
a
.
boxes
.
size
()
<
b
.
boxes
.
size
();
});
save_image_dataset_metadata
(
data
,
parser
[
0
]);
return
EXIT_SUCCESS
;
}
if
(
parser
.
option
(
"stats"
))
if
(
parser
.
option
(
"stats"
))
{
{
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