Skip to content

Instantly share code, notes, and snippets.

@Innov-Plus
Created July 2, 2021 09:51
Show Gist options
  • Select an option

  • Save Innov-Plus/5c91bd87112e1948f164e4cd7375dcdb to your computer and use it in GitHub Desktop.

Select an option

Save Innov-Plus/5c91bd87112e1948f164e4cd7375dcdb to your computer and use it in GitHub Desktop.
#include <input_parser.h>
#include <thread>
#include <klepsydra/onnx/onnx_dnn_importer.h>
#include <iostream>
int main(int argc, char **argv) {
InputData inputData;
InputParser::getConfFileFromParams(argc, argv, inputData);
std::shared_ptr<kpsr::ai::DeepNeuralNetworkFactory> factory =
kpsr::ai::OnnxDNNImporter::createDNNFactory(inputData.onnModelFile,
inputData.configurationFile);
std::shared_ptr<kpsr::ai::DeepNeuralNetwork> kpsrNetwork = factory->getDNN();
size_t processedImageCounter = 0;
kpsrNetwork->setCallback(
[&](const unsigned long &id, const kpsr::ai::F32AlignedVector &output) {
processedImageCounter++;
std::cout << "Processed " << processedImageCounter << std::endl;
});
kpsr::ai::F32AlignedVector inputVector(120 * 120 * 3, 0.f);
kpsrNetwork->predict(inputVector);
while (processedImageCounter < (100)) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment