Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
3929e238
Commit
3929e238
authored
Nov 15, 2014
by
Dmitriy Anisimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated adience loader
parent
9a0cc980
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
6 deletions
+62
-6
fr_adience.cpp
modules/datasets/samples/fr_adience.cpp
+2
-2
fr_adience.cpp
modules/datasets/src/fr_adience.cpp
+60
-4
No files found.
modules/datasets/samples/fr_adience.cpp
View file @
3929e238
...
...
@@ -97,8 +97,8 @@ int main(int argc, char *argv[])
printf
(
"y: %u
\n
"
,
example
->
y
);
printf
(
"dx: %u
\n
"
,
example
->
dx
);
printf
(
"dy: %u
\n
"
,
example
->
dy
);
printf
(
"tilt_ang: %
u
\n
"
,
example
->
tilt_ang
);
printf
(
"fiducial_yaw_angle: %
u
\n
"
,
example
->
fiducial_yaw_angle
);
printf
(
"tilt_ang: %
d
\n
"
,
example
->
tilt_ang
);
printf
(
"fiducial_yaw_angle: %
d
\n
"
,
example
->
fiducial_yaw_angle
);
printf
(
"fiducial_score: %u
\n
"
,
example
->
fiducial_score
);
return
0
;
...
...
modules/datasets/src/fr_adience.cpp
View file @
3929e238
...
...
@@ -42,6 +42,9 @@
#include "opencv2/datasets/fr_adience.hpp"
#include "opencv2/datasets/util.hpp"
#include <map>
#include <set>
namespace
cv
{
namespace
datasets
...
...
@@ -63,6 +66,9 @@ private:
void
loadFile
(
const
string
&
filename
,
vector
<
Ptr
<
FR_adienceObj
>
>
&
out
);
void
cv5ToSplits
(
vector
<
Ptr
<
FR_adienceObj
>
>
fileList
[
5
]);
map
<
string
,
vector
<
string
>
>
realNames
;
set
<
string
>
missing
;
};
/*FR_adienceImp::FR_adienceImp(const string &path)
...
...
@@ -79,15 +85,38 @@ void FR_adienceImp::loadFile(const string &filename, vector< Ptr<FR_adienceObj>
{
string
line
;
ifstream
infile
(
filename
.
c_str
());
getline
(
infile
,
line
);
// skip header
while
(
getline
(
infile
,
line
))
{
Ptr
<
FR_adienceObj
>
curr
(
new
FR_adienceObj
);
vector
<
string
>
elems
;
split
(
line
,
elems
,
','
);
curr
->
user_id
=
elems
[
0
];
curr
->
original_image
=
elems
[
1
];
string
user_id
=
elems
[
0
];
string
original_image
=
elems
[
1
];
// convert original_image to real image name
bool
isChanged
=
false
;
vector
<
string
>
&
currImgs
=
realNames
[
user_id
];
for
(
vector
<
string
>::
iterator
it
=
currImgs
.
begin
();
it
!=
currImgs
.
end
();
++
it
)
{
string
&
name
=
*
it
;
size_t
origImgLen
=
original_image
.
length
();
if
(
name
.
length
()
>
origImgLen
&&
name
.
substr
(
name
.
length
()
-
origImgLen
)
==
original_image
)
{
original_image
=
name
;
isChanged
=
true
;
break
;
}
}
if
(
!
isChanged
)
{
missing
.
insert
(
user_id
+
"/"
+
original_image
);
continue
;
}
Ptr
<
FR_adienceObj
>
curr
(
new
FR_adienceObj
);
curr
->
user_id
=
user_id
;
curr
->
original_image
=
original_image
;
curr
->
face_id
=
atoi
(
elems
[
2
].
c_str
());
curr
->
age
=
elems
[
3
];
if
(
elems
[
4
]
==
"m"
)
...
...
@@ -142,6 +171,26 @@ void FR_adienceImp::cv5ToSplits(vector< Ptr<FR_adienceObj> > fileList[5])
void
FR_adienceImp
::
loadDataset
(
const
string
&
path
)
{
// collect real image names
unsigned
int
num
=
0
;
vector
<
string
>
userNames
;
getDirList
(
path
+
"faces/"
,
userNames
);
for
(
vector
<
string
>::
iterator
itU
=
userNames
.
begin
();
itU
!=
userNames
.
end
();
++
itU
)
{
vector
<
string
>
fileNames
;
getDirList
(
path
+
"faces/"
+*
itU
+
"/"
,
fileNames
);
for
(
vector
<
string
>::
iterator
it
=
fileNames
.
begin
();
it
!=
fileNames
.
end
();
++
it
)
{
string
&
name
=
*
it
;
if
(
name
.
length
()
>
3
&&
name
.
substr
(
name
.
length
()
-
4
)
==
".jpg"
)
{
realNames
[
*
itU
].
push_back
(
name
);
num
++
;
}
}
}
//printf("total images number: %u\n", num);
vector
<
Ptr
<
FR_adienceObj
>
>
fileList
[
5
];
for
(
unsigned
int
i
=
0
;
i
<
5
;
++
i
)
{
...
...
@@ -163,6 +212,13 @@ void FR_adienceImp::loadDataset(const string &path)
loadFile
(
filename
,
fileList
[
i
]);
}
cv5ToSplits
(
fileList
);
/*for (set<string>::iterator it=missing.begin(); it!=missing.end(); ++it)
{
printf("missing image: %s\n", (*it).c_str());
}*/
realNames
.
clear
();
missing
.
clear
();
}
Ptr
<
FR_adience
>
FR_adience
::
create
()
...
...
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