Created
July 2, 2018 08:43
-
-
Save zaidalyafeai/2c2d7fc0d89fa3a9862cb6ab3b5bf627 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFrame() | |
{ | |
const ctx = canvas.getContext("2d"); | |
//get the minimum bounding box | |
const mbb = getMinBox() | |
imgData = ctx.getImageData(mbb.min.x, mbb.min.y, mbb.max.x - mbb.min.x, mbb.max.y - mbb.min.y); | |
//get the predictions, top 5 | |
const pred = model.predict(preprocess(imgData)).dataSync() | |
//find the top predictiosn | |
const indices = findIndicesOfMax(pred, 5) | |
const probs = findTopValues(pred, 5) | |
const symbols = getSymbols(indices) | |
//set the table | |
setTable(symbols, probs) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment