fixed bow sample
This commit is contained in:
parent
319c20c797
commit
b3f68d29e7
@ -2126,8 +2126,10 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
|
|||||||
if( !readVocabulary( filename, vocabulary) )
|
if( !readVocabulary( filename, vocabulary) )
|
||||||
{
|
{
|
||||||
CV_Assert( dextractor->descriptorType() == CV_32FC1 );
|
CV_Assert( dextractor->descriptorType() == CV_32FC1 );
|
||||||
const int descByteSize = dextractor->descriptorSize()*4;
|
const int elemSize = CV_ELEM_SIZE(dextractor->descriptorType());
|
||||||
const int maxDescCount = (trainParams.memoryUse * 1048576) / descByteSize; // Total number of descs to use for training.
|
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;
|
cout << "Extracting VOC data..." << endl;
|
||||||
vector<ObdImage> images;
|
vector<ObdImage> images;
|
||||||
@ -2142,9 +2144,8 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
|
|||||||
|
|
||||||
while( images.size() > 0 )
|
while( images.size() > 0 )
|
||||||
{
|
{
|
||||||
if( bowTrainer.descripotorsCount() >= maxDescCount )
|
if( bowTrainer.descripotorsCount() > maxDescCount )
|
||||||
{
|
{
|
||||||
assert( bowTrainer.descripotorsCount() == maxDescCount );
|
|
||||||
#ifdef DEBUG_DESC_PROGRESS
|
#ifdef DEBUG_DESC_PROGRESS
|
||||||
cout << "Breaking due to full memory ( descriptors count = " << bowTrainer.descripotorsCount()
|
cout << "Breaking due to full memory ( descriptors count = " << bowTrainer.descripotorsCount()
|
||||||
<< "; descriptor size in bytes = " << descByteSize << "; all used memory = "
|
<< "; descriptor size in bytes = " << descByteSize << "; all used memory = "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user