Skip to content

drivecapital/tensorflow-hacknight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Check out the TensorFlow Playground, then head to https://45.55.36.252/ to get started.

Once you've followed the tutorial and trained your network, you can use it to classify your own handwriting. Add the classify function at the end of your notebook:

import numpy as np

def classify(input, show=True):
    [predictions] = sess.run(y, feed_dict={ x: [input] })

    if show:
        for val in range(len(predictions)):
            print('{0}: {1:.2f}%'.format(val, predictions[val] * 100))

    prediction = np.argmax(predictions)
    return prediction

Now visit https://drivecapital.github.io/tensorflow-hacknight/ to draw a digit and export the value matrix. In your notebook, pass the exported matrix to the classify function to classify a digit:

classify([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.1882352977991104,0.125490203499794,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.3764705955982208,1,1,0.1882352977991104,0,0,0,0,0,0,0,0,0.250980406999588,0.8745098114013672,0.8745098114013672,0.125490203499794,0,0,0,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.43921568989753723,0,0,0,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0.5647059082984924,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0.9411764740943909,1,1,0.3764705955982208,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0.125490203499794,0.24705882370471954,0.30980393290519714,0.49803921580314636,0.49803921580314636,0.686274528503418,0.8117647171020508,1,1,1,1,1,0.8745098114013672,0.3764705955982208,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.8156862854957581,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0.9411764740943909,0.7529411911964417,0.7529411911964417,0.501960813999176,0.501960813999176,0.3764705955982208,0.250980406999588,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.501960813999176,1,1,0.501960813999176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.6274510025978088,1,1,0.43921568989753723,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.7529411911964417,1,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.7529411911964417,1,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.9411764740943909,1,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.9411764740943909,1,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.5647059082984924,1,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.125490203499794,1,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.7529411911964417,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.3764705955982208,1,0.250980406999588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])

0: 0.00%
1: 0.00%
2: 0.01%
3: 8.73%
4: 88.88%
5: 0.00%
6: 0.00%
7: 0.07%
8: 0.00%
9: 2.30%
4