# 前端与人工智能

·  阅读 9311

1. 开发公司官网？哈哈哈哈哈哈，其实也没毛病；
2. 工程平台的开发。例如模型服务平台、数据标注平台等大型AI应用；
3. 模型可视化(注意不是数据可视化哦)。用可视化的手段去解释模型，辅助算法同学调参；
4. 前端开发算法。啥？靠谱吗？放心吧，靠谱！我们有落地生产环境的经验！本文不会给你简单抛出几个什么tensorflow.js、keras.js、deeplearning.js等等这些，然后告诉你用这些前端就能做算法，且耐心看下去，有干货哦。

### 算法开发

1. asm.js
2. WebAssembly
3. GPU

1. 人脸识别
2. 人脸比对
3. 物体检测
4. 手势检测
5. 视频跟踪
6. ...

``````const input = tf.input({
shape: [timeStep, 9]
});
const inputReverse = tf.input({
shape: [timeStep, 9]
});
const gruFwd = tf.layers.gru({
units: 24,
unitForgetBias: true
});
const gruBwd = tf.layers.gru({
units: 24,
unitForgetBias: true
});
const fwd = gruFwd.apply(input);
const bwd = gruBwd.apply(inputReverse);

const lstmOpt = tf.layers
.activation({ activation: "relu" })
.apply(tf.layers.add().apply([fwd, bwd]));
let dense = tf.layers
.dense({
units: 24,
activation: "relu"
})
.apply(lstmOpt);
const outputs = tf.layers
.dense({
units: 2,
activation: "softmax"
})
.apply(dense);
model = tf.model({ inputs: [input, inputReverse], outputs: outputs });
console.log("training...");
let res;
model.compile({
loss: "categoricalCrossentropy",
optimizer: "adam"
});
train_data = tf.tensor3d(train_data);
train_label = tf.tensor2d(train_label);
train_data_reverse = tf.tensor3d(train_data_reverse);

res = await model.fit([train_data, train_data_reverse], train_label, {
epochs: 100
});