hughperkins / DeepCL

OpenCL library to train deep convolutional neural networks
Mozilla Public License 2.0
866 stars 200 forks source link

Re-Running Data Through #72

Closed haydenth closed 8 years ago

haydenth commented 8 years ago

Perhaps this question will reveal my lack of skills with neural nets :) Love this project and it's the best I've found available for neural net training on my old AMD GPU. One challenge I'm having a hard time finding in the documentation and code: I have built a model with PyDeepCL.NetLearner and I want to re-run some new data through it to get scores (in the machine learning sense..)

What method should I use? When I call getLastLayer().getOutput() - it doesn't seem to return the full set - just the last n rows put through in the training process. How can I push new data through it for scoring?

Thanks!

hughperkins commented 8 years ago

What method should I use? When I call getLastLayer().getOutput() - it doesn't seem to return the full set - just the last n rows put through in the training process. How can I push new data through it for scoring?

Yes, you'll need to pass each batch through one by one, and collect the results. By the way, you can probalby use getLastLayer().getLabels(), if you want the labels, rather than the raw outputs.

So, you'll do something like:

for test_batch in test_batches:
    net.forward(test_batches)
    batch_predictions = net.getLastLayer().getLabels()
    # do something with batch_predictions here...
haydenth commented 8 years ago

Cool, thanks. Once I get this working, I will send you a pull request with some updated python documentation and notes to help people. To date, this is the only deep learning library I've found that plays nicely with OpenCL and my old Radeon R7 370

hughperkins commented 8 years ago

Cool. Thanks! :-) Sounds good :-)