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
4041650f
Commit
4041650f
authored
Sep 12, 2014
by
dmitriy.anisimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated fr_lfw dataset loader
parent
5624ad2c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
25 deletions
+80
-25
datasetstools.rst
modules/datasetstools/doc/datasetstools.rst
+3
-3
fr_lfw.hpp
...es/datasetstools/include/opencv2/datasetstools/fr_lfw.hpp
+2
-2
ar_hmdb.cpp
modules/datasetstools/samples/ar_hmdb.cpp
+3
-0
fr_lfw.cpp
modules/datasetstools/samples/fr_lfw.cpp
+15
-10
fr_lfw.cpp
modules/datasetstools/src/fr_lfw.cpp
+56
-9
CMakeLists.txt
modules/xfeatures2d/CMakeLists.txt
+1
-1
No files found.
modules/datasetstools/doc/datasetstools.rst
View file @
4041650f
...
...
@@ -50,13 +50,13 @@ FR_lfw
Implements loading dataset:
_`"Labeled Faces in the Wild
-a"`: http://www.openu.ac.il/home/hassner/data/lfwa
/
_`"Labeled Faces in the Wild
"`: http://vis-www.cs.umass.edu/lfw
/
.. note:: Usage
1. From link above download
dataset file: lfwa.tar.gz
.
1. From link above download
any dataset file: lfw.tgz\lfwa.tar.gz\lfw-deepfunneled.tgz\lfw-funneled.tgz and file with 10 test splits: pairs.txt
.
2. Unpack
it
.
2. Unpack
dataset file and place pairs.txt in created folder
.
3. To load data run: ./opencv/build/bin/example_datasetstools_fr_lfw -p=/home/user/path_to_unpacked_folder/lfw2/
...
...
modules/datasetstools/include/opencv2/datasetstools/fr_lfw.hpp
View file @
4041650f
...
...
@@ -56,8 +56,8 @@ namespace datasetstools
struct
FR_lfwObj
:
public
Object
{
std
::
string
name
;
std
::
vector
<
std
::
string
>
images
;
std
::
string
image1
,
image2
;
bool
same
;
};
class
CV_EXPORTS
FR_lfw
:
public
Dataset
...
...
modules/datasetstools/samples/ar_hmdb.cpp
View file @
4041650f
...
...
@@ -72,6 +72,9 @@ int main(int argc, char *argv[])
// dataset contains for each split: a set of video file names for each action.
// For example, let output all training video file names for second split and first action.
// And its size.
int
numSplits
=
dataset
->
getNumSplits
();
printf
(
"splits number: %u
\n
"
,
numSplits
);
AR_hmdbObj
*
example
=
static_cast
<
AR_hmdbObj
*>
(
dataset
->
getTrain
(
1
)[
0
].
get
());
printf
(
"name: %s
\n
"
,
example
->
name
.
c_str
());
vector
<
string
>
&
videoNames
=
example
->
videoNames
;
...
...
modules/datasetstools/samples/fr_lfw.cpp
View file @
4041650f
...
...
@@ -69,16 +69,21 @@ int main(int argc, char *argv[])
dataset
->
load
(
path
);
// ***************
// dataset contains object with name and its images.
// For example, let output dataset size and sixth element.
printf
(
"dataset size: %u
\n
"
,
(
unsigned
int
)
dataset
->
getTrain
().
size
());
FR_lfwObj
*
example
=
static_cast
<
FR_lfwObj
*>
(
dataset
->
getTrain
()[
5
].
get
());
printf
(
"sixth dataset object:
\n
%s
\n
"
,
example
->
name
.
c_str
());
string
currPath
(
path
+
example
->
name
+
"/"
);
for
(
vector
<
string
>::
iterator
it
=
example
->
images
.
begin
();
it
!=
example
->
images
.
end
();
++
it
)
{
printf
(
"%s
\n
"
,
(
currPath
+
(
*
it
)).
c_str
());
}
// test contains two images and flag that they belong to one person.
// For example, let output splits number, test size and split 1, elements: 1, 301.
int
numSplits
=
dataset
->
getNumSplits
();
printf
(
"splits number: %u
\n
"
,
numSplits
);
printf
(
"test size: %u
\n
"
,
(
unsigned
int
)
dataset
->
getTest
().
size
());
FR_lfwObj
*
example
=
static_cast
<
FR_lfwObj
*>
(
dataset
->
getTest
()[
0
].
get
());
printf
(
"first test, first image: %s
\n
"
,
example
->
image1
.
c_str
());
printf
(
"first test, second image: %s
\n
"
,
example
->
image2
.
c_str
());
printf
(
"first test, same: %s
\n
"
,
example
->
same
?
"yes"
:
"no"
);
example
=
static_cast
<
FR_lfwObj
*>
(
dataset
->
getTest
()[
300
].
get
());
printf
(
"300 test, first image: %s
\n
"
,
example
->
image1
.
c_str
());
printf
(
"300 test, second image: %s
\n
"
,
example
->
image2
.
c_str
());
printf
(
"300 test, same: %s
\n
"
,
example
->
same
?
"yes"
:
"no"
);
return
0
;
}
modules/datasetstools/src/fr_lfw.cpp
View file @
4041650f
...
...
@@ -42,6 +42,8 @@
#include "opencv2/datasetstools/fr_lfw.hpp"
#include "precomp.hpp"
#include <map>
namespace
cv
{
namespace
datasetstools
...
...
@@ -60,6 +62,8 @@ public:
private
:
void
loadDataset
(
const
string
&
path
);
map
<
string
,
vector
<
string
>
>
faces
;
};
/*FR_lfwImp::FR_lfwImp(const string &path)
...
...
@@ -74,26 +78,69 @@ void FR_lfwImp::load(const string &path)
void
FR_lfwImp
::
loadDataset
(
const
string
&
path
)
{
train
.
push_back
(
vector
<
Ptr
<
Object
>
>
());
test
.
push_back
(
vector
<
Ptr
<
Object
>
>
());
validation
.
push_back
(
vector
<
Ptr
<
Object
>
>
());
vector
<
string
>
fileNames
;
getDirList
(
path
,
fileNames
);
for
(
vector
<
string
>::
iterator
it
=
fileNames
.
begin
();
it
!=
fileNames
.
end
();
++
it
)
{
Ptr
<
FR_lfwObj
>
curr
(
new
FR_lfwObj
);
curr
->
name
=
*
it
;
if
(
"pairs.txt"
==
*
it
)
{
continue
;
}
string
pathFace
(
path
+
curr
->
name
+
"/"
);
string
&
name
=
*
it
;
vector
<
string
>
images
;
string
pathFace
(
path
+
name
+
"/"
);
vector
<
string
>
faceNames
;
getDirList
(
pathFace
,
faceNames
);
for
(
vector
<
string
>::
iterator
itFace
=
faceNames
.
begin
();
itFace
!=
faceNames
.
end
();
++
itFace
)
{
curr
->
images
.
push_back
(
*
itFace
);
images
.
push_back
(
*
itFace
);
}
train
.
back
().
push_back
(
curr
);
faces
.
insert
(
make_pair
(
name
,
images
));
}
// test loading
ifstream
infile
((
path
+
"pairs.txt"
).
c_str
());
string
line
;
getline
(
infile
,
line
);
// should be 10 300
unsigned
int
num
=
0
;
while
(
getline
(
infile
,
line
))
{
if
(
0
==
(
num
%
600
))
{
train
.
push_back
(
vector
<
Ptr
<
Object
>
>
());
test
.
push_back
(
vector
<
Ptr
<
Object
>
>
());
validation
.
push_back
(
vector
<
Ptr
<
Object
>
>
());
}
vector
<
string
>
elems
;
split
(
line
,
elems
,
'\t'
);
Ptr
<
FR_lfwObj
>
curr
(
new
FR_lfwObj
);
string
&
person1
=
elems
[
0
];
unsigned
int
imageNumber1
=
atoi
(
elems
[
1
].
c_str
())
-
1
;
curr
->
image1
=
person1
+
"/"
+
faces
[
person1
][
imageNumber1
];
string
person2
;
unsigned
int
imageNumber2
;
if
(
3
==
elems
.
size
())
{
person2
=
elems
[
0
];
imageNumber2
=
atoi
(
elems
[
2
].
c_str
())
-
1
;
curr
->
same
=
true
;
}
else
{
person2
=
elems
[
2
];
imageNumber2
=
atoi
(
elems
[
3
].
c_str
())
-
1
;
curr
->
same
=
false
;
}
curr
->
image2
=
person2
+
"/"
+
faces
[
person2
][
imageNumber2
];
test
.
back
().
push_back
(
curr
);
num
++
;
}
}
...
...
modules/xfeatures2d/CMakeLists.txt
View file @
4041650f
set
(
the_description
"Contributed/Experimental Algorithms for Salient 2D Features Detection"
)
ocv_define_module
(
xfeatures2d opencv_core opencv_
cudaarithm opencv_imgproc opencv_features2d opencv_calib3d opencv_shape opencv_highgui opencv_videoio opencv_ml
)
ocv_define_module
(
xfeatures2d opencv_core opencv_
imgproc opencv_features2d opencv_calib3d opencv_shape opencv_highgui opencv_videoio opencv_ml opencv_cudaarithm
)
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