Comments (3)
Well... you just need to create an appropriate input tensor, and send that in, using the python api, or the c++ api, or via the commandline. What language are you using for your prediction? If python, then you would do something like:
(adapted from https://github.com/hughperkins/DeepCL/blob/master/python/test_lowlevel.py)
inputTensor = array.array('f', [0] * (numPlanes * boardSize * boardSize))
# ... populate the inputTensor somehow ... , and then
net.forward(inputTensor)
lastLayer = net.getLastLayer()
predictions = lastLayer.getLabels()
from deepcl.
Thank you for your response. For now I use commandline to do prediction, i tried make a DAT file as inputTensor with single SGF file from kgsgo-dataset-preprocessorv2. and add header
mlv2-n=1-numplanes=7-imagewidth=19-imageheight=19-datatype=int-bpp=1
to the DAT file, Which n i assume it to 1 because I make the DAT file with single SGF file and one move only. After I do prediction with commandline. it shows n entries data, each entry has 361 numfield.
My question is the 361 numfield that possible is the probability of the SGF's next move on go game?
Thank you for your help!
from deepcl.
Ok, the n
is indeed the number of examples in the file. From src/loaders/Kgsv2Loader.cpp:
int N = atoi(split(split(headerString, "-n=")[1], "-")[0]);
int numPlanes = atoi(split(split(headerString, "-numplanes=")[1], "-")[0]);
int imageSize = atoi(split(split(headerString, "-imagewidth=")[1], "-")[0]);
int imageSizeRepeated = atoi(split(split(headerString, "-imageheight=")[1], "-")[0]);
...
if(numRecords == 0) {
numRecords = N - startRecord;
}
...
for(int n = 0; n < numRecords; n++) {
...
}
As far as the output, the relevant code is in src/main/predict.cpp:
if(!config.writeLabels) {
if(config.outputFormat == "text") {
float const*output = net->getLayer(config.outputLayer)->getOutput();
const int numFields = net->getLayer(config.outputLayer)->getOutputCubeSize();
for(int i = 0; i < config.batchSize; i++) {
for(int f = 0; f < numFields; f++) {
if(f > 0) {
*outFile << " ";
}
*outFile << output[ i * numFields + f ];
}
*outFile << "\n";
}
} else {
outFile->write(reinterpret_cast<const char *>(net->getOutput()), net->getOutputNumElements() * 4 * config.batchSize);
}
} else {
SoftMaxLayer *softMaxLayer = dynamic_cast< SoftMaxLayer *>(net->getLayer(config.outputLayer) );
if(softMaxLayer == 0) {
cout << "must choose softmaxlayer, if want to output labels" << endl;
return;
}
softMaxLayer->getLabels(labels);
if(config.outputFormat == "text") {
for(int i = 0; i < config.batchSize; i++) {
*outFile << labels[i] << "\n";
}
} else {
outFile->write(reinterpret_cast< char * >(labels), config.batchSize * 4l);
}
outFile->flush();
}
- if config.writeLabels is 1, it's going to write one label per example, one for each of the batchsize examples
- otherwise, as you say, its going to write hte output of the final softmax layer. Each line will contain the output probability distribution for one sample in the minibatch
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.