Created
April 23, 2019 00:28
-
-
Save ivder/d4d3fd017e6a267f5a257aec459cc80a to your computer and use it in GitHub Desktop.
Intel OpenVino Classification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassificationWithIntel.h" | |
#include "IntelClassification.h" | |
using namespace IntelVINOLib; | |
class ClassificationWithIntelContext | |
{ | |
public: | |
ClassificationWithIntelContext() {} | |
~ClassificationWithIntelContext() {} | |
IntelVINOClassification* Intel_VINO_Classification; | |
}; | |
ClassificationWithIntel::ClassificationWithIntel(std::string modelPath) { | |
IntelModelPath = modelPath; | |
ctx = new ClassificationWithIntelContext(); | |
ctx->Intel_VINO_Classification = new IntelVINOClassification(IntelModelPath); | |
} | |
ClassifyResultCNN ClassificationWithIntel::Classify(std::string imagePath) { | |
IntelImagePath = imagePath; | |
int predictionNum= ctx->Intel_VINO_Classification->IntelClassify(IntelImagePath); | |
std::string prediction; | |
if (predictionNum == 18) { | |
prediction = "patchdamaged"; | |
} | |
else if (predictionNum == 20) { | |
prediction = "pothole"; | |
} | |
else if (predictionNum == 23) { | |
prediction = "spalling"; | |
} | |
else if (predictionNum == 24) { | |
prediction = "spallingcross"; | |
} | |
else { | |
prediction = "nonDefect"; | |
} | |
ofstream outfile; | |
outfile.open("C:\\algorithm_testing\\inference.txt", ios::out | ios::app); | |
outfile << to_string(predictionNum) << " " << prediction << endl; | |
outfile.close(); | |
ClassifyResultCNN R; | |
R.className = prediction; | |
//R.predictRate = predictions.at(0).second * 100; | |
R.isDefect = R.className.compare(DEFECT_PATCHDAMAGED) == 0 | |
|| R.className.compare(DEFECT_SPALLING) == 0 || R.className.compare(DEFECT_SPALLINGCROSS) == 0 | |
|| R.className.compare(DEFECT_POTHOLE) == 0; | |
return R; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment