计算TensorflowJS中的标准偏差?
我正在编写我的第一个TFJS演示应用程序。我有一个训练有素的猫/狗二进制分类器,我已经使用转换器转换。我可以加载模型,并通过iphone或android摄像头传送图像进行分类。不幸的是,结果很糟糕。我的模型使用keras ImageDataGenerator进行训练,samplewise_center和samplewise_std_归一化都设置为true。我现在非常确定我需要在我的应用程序中执行同样的规范化计算TensorflowJS中的标准偏差?,tensorflow,tensorflow.js,Tensorflow,Tensorflow.js,我正在编写我的第一个TFJS演示应用程序。我有一个训练有素的猫/狗二进制分类器,我已经使用转换器转换。我可以加载模型,并通过iphone或android摄像头传送图像进行分类。不幸的是,结果很糟糕。我的模型使用keras ImageDataGenerator进行训练,samplewise_center和samplewise_std_归一化都设置为true。我现在非常确定我需要在我的应用程序中执行同样的规范化 我在完整的API中看到了tf.math.reduce_mean()和reduce_std
我在完整的API中看到了tf.math.reduce_mean()和reduce_std()。在JSAPI中,我看到了ts.mean(),但没有看到ts.std()。我需要从头开始计算std吗?js api中还没有计算标准偏差的操作符。它可以从头开始计算,也可以使用
tf.矩
获得方差,然后使用平方根计算标准偏差
const a = tf.tensor1d([1, 2, 3]);
tf.moments(a).variance.print()
tf.moments(a).variance.sqrt().print()