Commit d32ba202f06b8f85a60d4bb0e4592f8167ddb4cf

Authored by Jordan Cheney
1 parent 19a31ced

More efficient hash-based search in getNumberOfImages

Showing 1 changed file with 4 additions and 5 deletions
openbr/core/eval.cpp
@@ -747,12 +747,11 @@ static QMap<QString, Detections> getDetections(const File &predictedGallery, con @@ -747,12 +747,11 @@ static QMap<QString, Detections> getDetections(const File &predictedGallery, con
747 747
748 static int getNumberOfImages(const File &truthGallery) 748 static int getNumberOfImages(const File &truthGallery)
749 { 749 {
750 - const FileList files = TemplateList::fromGallery(truthGallery).files(); 750 + const FileList files = FileList::fromGallery(truthGallery);
751 751
752 - QStringList names;  
753 - foreach(const File file, files)  
754 - if (!names.contains(file.fileName()))  
755 - names.append(file.fileName()); 752 + QSet<QString> names;
  753 + foreach(const File &file, files)
  754 + names.insert(file.fileName());
756 return names.size(); 755 return names.size();
757 } 756 }
758 757