Commit c8a003100c8b2eeec802483ff908b01091badfd6
1 parent
0e64c2be
removed turk
Showing
1 changed file
with
0 additions
and
75 deletions
openbr/plugins/classification/turk.cpp deleted
| 1 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | - * Copyright 2012 The MITRE Corporation * | |
| 3 | - * * | |
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); * | |
| 5 | - * you may not use this file except in compliance with the License. * | |
| 6 | - * You may obtain a copy of the License at * | |
| 7 | - * * | |
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 * | |
| 9 | - * * | |
| 10 | - * Unless required by applicable law or agreed to in writing, software * | |
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, * | |
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | |
| 13 | - * See the License for the specific language governing permissions and * | |
| 14 | - * limitations under the License. * | |
| 15 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 16 | - | |
| 17 | -#include <openbr/plugins/openbr_internal.h> | |
| 18 | - | |
| 19 | -namespace br | |
| 20 | -{ | |
| 21 | - | |
| 22 | -/*! | |
| 23 | - * \ingroup transforms | |
| 24 | - * \brief Convenience class for training turk attribute regressors | |
| 25 | - * \author Josh Klontz \cite jklontz | |
| 26 | - * \br_property QString key Metadata key to pass input values to SVM. Actual lookup key is "key_value" where value is each value in the parameter values. Default is "". | |
| 27 | - * \br_property QStringList values Metadata keys to pass input values to SVM. Actual lookup key is "key_value" where key is the parameter key and value is each value in this list. Each passed value trains a new SVM with the input values found in metadata["key_value"]. Default is "". | |
| 28 | - * \br_property bool isMeta If true, "Average+SaveMat(predicted_key_value)" is appended to each classifier. If false, nothing is appended. Default is false. | |
| 29 | - */ | |
| 30 | -class TurkClassifierTransform : public Transform | |
| 31 | -{ | |
| 32 | - Q_OBJECT | |
| 33 | - Q_PROPERTY(QString key READ get_key WRITE set_key RESET reset_key STORED false) | |
| 34 | - Q_PROPERTY(QStringList values READ get_values WRITE set_values RESET reset_values STORED false) | |
| 35 | - Q_PROPERTY(bool isMeta READ get_isMeta WRITE set_isMeta RESET reset_isMeta STORED false) | |
| 36 | - BR_PROPERTY(QString, key, QString()) | |
| 37 | - BR_PROPERTY(QStringList, values, QStringList()) | |
| 38 | - BR_PROPERTY(bool, isMeta, false) | |
| 39 | - | |
| 40 | - Transform *child; | |
| 41 | - | |
| 42 | - void init() | |
| 43 | - { | |
| 44 | - QStringList classifiers; | |
| 45 | - foreach (const QString &value, values) | |
| 46 | - classifiers.append(QString("(SVM(RBF,EPS_SVR,returnDFVal=true,inputVariable=%1,outputVariable=predicted_%1)%2)").arg(key + "_" + value, isMeta ? QString("+Average+SaveMat(predicted_%1)").arg(value) : QString())); | |
| 47 | - child = Transform::make(classifiers.join("/") + (classifiers.size() > 1 ? "+Cat" : "")); | |
| 48 | - } | |
| 49 | - | |
| 50 | - void train(const QList<TemplateList> &data) | |
| 51 | - { | |
| 52 | - child->train(data); | |
| 53 | - } | |
| 54 | - | |
| 55 | - void project(const Template &src, Template &dst) const | |
| 56 | - { | |
| 57 | - child->project(src, dst); | |
| 58 | - } | |
| 59 | - | |
| 60 | - void store(QDataStream &stream) const | |
| 61 | - { | |
| 62 | - child->store(stream); | |
| 63 | - } | |
| 64 | - | |
| 65 | - void load(QDataStream &stream) | |
| 66 | - { | |
| 67 | - child->load(stream); | |
| 68 | - } | |
| 69 | -}; | |
| 70 | - | |
| 71 | -BR_REGISTER(Transform, TurkClassifierTransform) | |
| 72 | - | |
| 73 | -} // namespace br | |
| 74 | - | |
| 75 | -#include "classification/turk.moc" |