From ed2a8f7b758fc97e71c31d15afa15db2d03d8a66 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Tue, 31 Aug 2021 17:54:43 -0600 Subject: [PATCH] remove majorityvoting --- openbr/plugins/metadata/majorityvoting.cpp | 104 -------------------------------------------------------------------------------------------------------- 1 file changed, 0 insertions(+), 104 deletions(-) delete mode 100644 openbr/plugins/metadata/majorityvoting.cpp diff --git a/openbr/plugins/metadata/majorityvoting.cpp b/openbr/plugins/metadata/majorityvoting.cpp deleted file mode 100644 index 9cef189..0000000 --- a/openbr/plugins/metadata/majorityvoting.cpp +++ /dev/null @@ -1,104 +0,0 @@ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright 2015 Rank One Computing Corporation * - * * - * Licensed under the Apache License, Version 2.0 (the "License"); * - * you may not use this file except in compliance with the License. * - * You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an "AS IS" BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -namespace br -{ - -/*! - * \ingroup transforms - * \brief Performs majority voting from a single metadata key or multiple keys and sets the result in the specified key. - * \br_property QString keys The meta-data key(s) used for Majority Voting. - * \br_property int numClasses The number of possible classes. - * \br_property QString outputKey The output metadata key which stores the a list with the index of the winning class set to 1. - * \br_property float thresh Allows users to specify a threshold for the first class, if exceeded the first class wins else class 2 wins. - * \author Keyur Patel \cite kpatel - */ -class MajorityVotingTransform : public UntrainableMetadataTransform -{ - Q_OBJECT - Q_PROPERTY(QStringList keys READ get_keys WRITE set_keys RESET reset_keys STORED false) - Q_PROPERTY(int numClasses READ get_numClasses WRITE set_numClasses RESET reset_numClasses STORED false) - Q_PROPERTY(QString outputKey READ get_outputKey WRITE set_outputKey RESET reset_outputKey STORED false) - Q_PROPERTY(float thresh READ get_thresh WRITE set_thresh RESET reset_thresh STORED false) - - BR_PROPERTY(QStringList, keys, QStringList()) - BR_PROPERTY(int, numClasses, 2) - BR_PROPERTY(QString, outputKey, "MajorityVoting") - BR_PROPERTY(float, thresh, -1) - - void projectMetadata(const File &src, File &dst) const - { - dst = src; - - QList scores = QList(); - foreach (QString key, keys){ - if (src.contains(key)){ - QList templateScores = src.getList(key); - scores.append(templateScores); - } else { - dst.fte = true; - return; - } - } - QVector classCount(numClasses, 0); - for (int c = 0; c < scores.size(); c+= numClasses){ - if ((numClasses == 2) && (thresh != -1)){ - if (scores[c] > thresh) - classCount[0]++; - else - classCount[1]++; - } else { - int highestScoringClass = 0; - float highestScore = scores[c]; - for (int b = 1; b < numClasses; b++){ - if (scores[c+b] > highestScore){ - highestScore = scores[c+b]; - highestScoringClass = b; - } - } - classCount[highestScoringClass]++; - } - } - int largestIndex = getIndexOfLargestElement(classCount); - - QList output = QList(); - for(int i=0; i &arr) const { - int largestIndex = 0; - for (int i = largestIndex; i < arr.size(); i++) { - if (arr[largestIndex] <= arr[i]) { - largestIndex = i; - } - } - return largestIndex; - } -}; - -BR_REGISTER(Transform, MajorityVotingTransform) - -} // namespace br - -#include "metadata/majorityvoting.moc" - -- libgit2 0.21.4