Closed cyr6 closed 6 years ago
Hi, Right now, there is no command line option to do exactly what you want, but this is actually easy using the N2D2 C++ API. This is done in the n2d2_live executable for example. The relevant piece of code is the following:
deepNet
->getStimuliProvider()
->streamStimulus(img, Database::Test);
deepNet->test(Database::Test);
std::shared_ptr<TargetScore> targetPicture
= deepNet->getTarget<TargetScore>();
const Tensor3d<int> estimatedLabel
= targetPicture->getEstimatedLabels()[0];
const Tensor3d<Float_T> estimatedLabelValue
= targetPicture->getEstimatedLabelsValue()[0];
Then, to display or save the labels estimated probabilities:
for (unsigned int i = 0, size = TOPN; i < size; ++i) {
std::string displayEstimatedName
= deepNet->getDatabase()->getLabelName(estimatedLabel(i));
double displayEstimatedValue = estimatedLabelValue(i);
std::cout << displayEstimatedName
<< ": "
<< displayEstimatedValue
<< "\n";
}
For the exports, only the CPP_cuDNN export is available in the open source N2D2 right now. Please refer to the manual (section "About N2D2-IP") to obtain more information on the availability of other export modules.
Thanks a lot for your time and these informations - with a little bit of modifications here and there I was able to extract what I wanted.
Hello,
Assuming a functional DNN written as a .ini file, and a training already done, I would like to be able to extract the output (the Target) of a particular frame.
The -test-idx options allows to test the neural network on specific frames, which creates a folder frames/ containing images with values in {-1, 0, 1}. What I would like to get instead, is the actual output that says e.g. 57% chance that's it's a car, 18% chance that it's a horse, etc.., the binary content with one float value per possible label.
Is there a possibility to do that within the current framework?
I also tried messing with the -export functions, but unfortunately it generates no Makefile to compile the generated files, it seems that either something is missing or i am missing something. I tried with the CPP export, since I would like to run it on my CPU.
Thanks for your answers