Comments (9)
Hmmm... been a long time since I looked at this... As far as the literal output to your question, you mean how to calculate the label given the probabilities? So it will just be whichever layer gives the maximum probability.
In the underlying c++ library though, the SoftMax layers has a method void getLabels(int *labels)
, https://github.com/hughperkins/DeepCL/blob/master/src/loss/SoftMaxLayer.cpp#L297 , which will do this for you. But I will need to ponder a bit how to expose this in the python layer, so you might want to just hack and paste that method into python for now, ie this code:
for(int n = 0; n < batchSize; n++) {
float *outputStack = output + n * numPlanes;
float highestProb = outputStack[0];
int bestPlane = 0;
for(int plane = 1; plane < numPlanes; plane++) {
if(outputStack[plane] > highestProb) {
bestPlane = plane;
highestProb = outputStack[plane];
}
}
labels[n] = bestPlane;
}
from deepcl.
Right, I figure I could do something like above. The issue is that the python wrapper's get output method doesn't provide access to all the planes....maybe just one or the max of each plane for each input.
from deepcl.
Hmmm, glancing through the code (since as I say, it's been a while :-P ), it looks like getOutput
should return an array that is getOutputNumElements()
long, and getOutputNumElements()
is an abstract method of Layer
, which is overridden by LossLayer
, and simply returns the number of output elements of the previous layer.
So, in theory, if I'm reading correctly, the size of getOutput should be the same as the size of the output of the previous layer.
Can you post the code that you're using to test, and I can have a play?
from deepcl.
I dunno what I was looking at/doing..I revisited my test cases and this looks like its working perfectly...sorry for the trouble!
from deepcl.
Ok, cool :-) By the way, do you most need the predicted output label of each example, or do you most need the underlying probabilities?
from deepcl.
just the underlying probabilities is good enough for me, but I can defs see the use for a wrapper for the prediction...it would make it that much easier...
from deepcl.
Hi Matthew, ok, you mean, probabilities are enough, because you already have the code to convert to labels? or probabilities are what you are actually trying to obtain currently, dont need the labels?
from deepcl.
I need both, so I do need the labels, but I am already working with the probabilities so I don't mind computing the labels myself.
from deepcl.
Added in d70b598 . You can see test_lowlevel.py lines 66-68 for an example:
lastLayer = net.getLastLayer()
predictions = lastLayer.getLabels()
print('predictions', predictions)
from deepcl.
Related Issues (20)
- MNIST data format HOT 1
- Python Q-Learning - Add Dropout Layout causes runtime error HOT 11
- can passed all test in #ad1ab61, but not now (#b256220) HOT 48
- function "NetLearner::learn" is deprecated, how to train a network by the new method? HOT 2
- How to use ExpectedData correctly in training? HOT 2
- tutorial and documentation is very less
- integrated demo HOT 2
- could deepcl run on FPGAs? HOT 1
- deepcl_predict HOT 5
- does the Neural network created on GPU? HOT 3
- captcha
- pip with windows does not work
- Need cythonize
- deepcl_unittests not running in CentOS 7. HOT 2
- opencl 1.1?
- Feature Request: Add Mish activation HOT 3
- How to set stride of conv layer? HOT 2
- Implementation of DNN on FPGA HOT 2
- Any examples for face detection?
- is there any ConvTranspose2d?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepcl.