comparison transform/FeatureExtractionModelTransformer.cpp @ 1762:110f853c3149 by-id

Deleted-model checks, & debug output
author Chris Cannam
date Mon, 15 Jul 2019 14:12:37 +0100
parents fd7f127ecd89
children d1e2062cbdec
comparison
equal deleted inserted replaced
1761:ee7fd2c01d87 1762:110f853c3149
768 768
769 int completion = int 769 int completion = int
770 ((((blockFrame - contextStart) / stepSize) * 99) / 770 ((((blockFrame - contextStart) / stepSize) * 99) /
771 (contextDuration / stepSize + 1)); 771 (contextDuration / stepSize + 1));
772 772
773 bool haveAllModels = true;
773 if (!ModelById::get(inputId)) { 774 if (!ModelById::get(inputId)) {
775 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
776 SVDEBUG << "FeatureExtractionModelTransformer::run: Input model " << inputId << " no longer exists" << endl;
777 #endif
778 haveAllModels = false;
779 } else {
780 SVDEBUG << "Input model " << inputId << " still exists" << endl;
781 }
782 for (auto mid: m_outputs) {
783 if (!ModelById::get(mid)) {
784 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
785 SVDEBUG << "FeatureExtractionModelTransformer::run: Output model " << mid << " no longer exists" << endl;
786 #endif
787 haveAllModels = false;
788 } else {
789 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
790 SVDEBUG << "Output model " << mid << " still exists" << endl;
791 #endif
792 }
793 }
794 if (!haveAllModels) {
774 abandon(); 795 abandon();
775 return; 796 break;
776 } 797 }
798
799 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
800 SVDEBUG << "FeatureExtractionModelTransformer::run: All models still exist" << endl;
801 #endif
777 802
778 // channelCount is either input->channelCount or 1 803 // channelCount is either input->channelCount or 1
779 804
780 if (frequencyDomain) { 805 if (frequencyDomain) {
781 for (int ch = 0; ch < channelCount; ++ch) { 806 for (int ch = 0; ch < channelCount; ++ch) {
836 861
837 for (int j = 0; in_range_for(m_outputNos, j); ++j) { 862 for (int j = 0; in_range_for(m_outputNos, j); ++j) {
838 for (int fi = 0; in_range_for(features[m_outputNos[j]], fi); ++fi) { 863 for (int fi = 0; in_range_for(features[m_outputNos[j]], fi); ++fi) {
839 auto feature = features[m_outputNos[j]][fi]; 864 auto feature = features[m_outputNos[j]][fi];
840 addFeature(j, blockFrame, feature); 865 addFeature(j, blockFrame, feature);
866 if (m_abandoned) {
867 break;
868 }
841 } 869 }
842 } 870 }
843 } 871 }
844 } catch (const std::exception &e) { 872 } catch (const std::exception &e) {
845 SVCERR << "FeatureExtractionModelTransformer::run: Exception caught: " 873 SVCERR << "FeatureExtractionModelTransformer::run: Exception caught: "
1107 if (!feature.hasTimestamp && m_fixedRateFeatureNos[n] >= 0) { 1135 if (!feature.hasTimestamp && m_fixedRateFeatureNos[n] >= 0) {
1108 model->setColumn(m_fixedRateFeatureNos[n], values); 1136 model->setColumn(m_fixedRateFeatureNos[n], values);
1109 } else { 1137 } else {
1110 model->setColumn(int(frame / model->getResolution()), values); 1138 model->setColumn(int(frame / model->getResolution()), values);
1111 } 1139 }
1112 } 1140 } else {
1113 1141
1114 SVDEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type!" << endl; 1142 SVDEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type - possibly a deleted model" << endl;
1143 abandon();
1144 }
1115 } 1145 }
1116 1146
1117 void 1147 void
1118 FeatureExtractionModelTransformer::setCompletion(int n, int completion) 1148 FeatureExtractionModelTransformer::setCompletion(int n, int completion)
1119 { 1149 {