Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
b3f68d29
Commit
b3f68d29
authored
Jul 02, 2012
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bow sample
parent
319c20c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
bagofwords_classification.cpp
samples/cpp/bagofwords_classification.cpp
+6
-5
No files found.
samples/cpp/bagofwords_classification.cpp
View file @
b3f68d29
...
...
@@ -2014,7 +2014,7 @@ struct VocabTrainParams
// It shouldn't matter which object class is specified here - visual vocab will still be the same.
int
vocabSize
;
//number of visual words in vocabulary to train
int
memoryUse
;
// Memory to preallocate (in MB) when training vocab.
// Change this depending on the size of the dataset/available memory.
// Change this depending on the size of the dataset/available memory.
float
descProportion
;
// Specifies the number of descriptors to use from each image as a proportion of the total num descs.
};
...
...
@@ -2126,8 +2126,10 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
if
(
!
readVocabulary
(
filename
,
vocabulary
)
)
{
CV_Assert
(
dextractor
->
descriptorType
()
==
CV_32FC1
);
const
int
descByteSize
=
dextractor
->
descriptorSize
()
*
4
;
const
int
maxDescCount
=
(
trainParams
.
memoryUse
*
1048576
)
/
descByteSize
;
// Total number of descs to use for training.
const
int
elemSize
=
CV_ELEM_SIZE
(
dextractor
->
descriptorType
());
const
int
descByteSize
=
dextractor
->
descriptorSize
()
*
elemSize
;
const
int
bytesInMB
=
1048576
;
const
int
maxDescCount
=
(
trainParams
.
memoryUse
*
bytesInMB
)
/
descByteSize
;
// Total number of descs to use for training.
cout
<<
"Extracting VOC data..."
<<
endl
;
vector
<
ObdImage
>
images
;
...
...
@@ -2142,9 +2144,8 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
while
(
images
.
size
()
>
0
)
{
if
(
bowTrainer
.
descripotorsCount
()
>
=
maxDescCount
)
if
(
bowTrainer
.
descripotorsCount
()
>
maxDescCount
)
{
assert
(
bowTrainer
.
descripotorsCount
()
==
maxDescCount
);
#ifdef DEBUG_DESC_PROGRESS
cout
<<
"Breaking due to full memory ( descriptors count = "
<<
bowTrainer
.
descripotorsCount
()
<<
"; descriptor size in bytes = "
<<
descByteSize
<<
"; all used memory = "
...
...
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