Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript
😁 不可能的
生物神经网络
人工神经网络
论人类有多爱甜食
教人工神经网络如何吃糖
神经网络
基本流程
卷积神经网络
卷积神经网络
简单图形
五官
人脸
19 MB
1.7 MB
const model = new window.KerasJS.Model({
filepath: '/static/captcha__model.bin',
gpu: true,
transferLayerOutputs: true
})
实例化模型
predict () {
const { canvas } = this.$refs
const ctx = canvas.getContext('2d')
const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height)
// 预处理图片数据
const data = this.preprocess(imageData)
const inputName = this.model.inputLayerNames[0]
const outputName = this.model.outputLayerNames[0]
const inputData = {
[inputName]: data
}
this.model.predict(inputData).then(outputData => {
console.log(outputData)
// 将概率数据转换为验证码字母
this.vev2capcha(outputData[outputName])
})
}
模型预测
⚠️ 可能你的设备不能正常运行它
参考
https://keras-cn.readthedocs.io/en/latest/?q=h5&check_keywords=yes&area=default
https://transcranial.github.io/keras-js-docs/
https://transcranial.github.io/keras-js
https://developers.google.cn/machine-learning/crash-course/
https://www.jianshu.com/p/3a22e8283cda
https://morvanzhou.github.io/tutorials/machine-learning/ML-intro/2-0-ANN-and-NN/