我正在尝试运行jupyter笔记本并出现以下错误。我正在将Win 7与Anaconda python 3.7一起使用。
ImportError:numpy安装出了点问题。导入时,我们在['c:\ users \ paperspace \ anaconda3 \ envs \ tensorflow10 \ lib \ site-packages \ numpy']中检测到了较旧的numpy版本。解决此问题的一种方法是重复卸载numpy,直到找不到为止,然后重新安装此版本。
我已按照错误中提到的步骤进行操作,但仍然无法正常工作。
编译模型然后保存。然后在加载模型时出错。
def triplet_loss(y_true, y_pred, alpha = 0.3):
anchor, positive, negative = y_pred[0], y_pred[1], y_pred[2]
pos_dist = tf.reduce_sum(tf.square(tf.subtract(anchor, positive)), axis=-1)
neg_dist = tf.reduce_sum(tf.square(tf.subtract(anchor, negative)), axis=-1)
basic_loss = tf.add(tf.subtract(pos_dist, neg_dist), alpha)
loss = tf.reduce_sum(tf.maximum(basic_loss, 0.0))
return loss
FRmodel.compile(optimizer = 'adam', loss = triplet_loss, metrics =
['accuracy'])
FRmodel.save('model.h5')
`FRmodel = load_model('model.h5')`
ValueError: Unknown loss function:triplet_loss
Run Code Online (Sandbox Code Playgroud) numpy.array(image)和img_to_array(image)功能和有什么不一样?img_to_array是在keras.preprocessing.image包裹内。我想将它与图像一起用作此函数的输入。
运行时错误:
必须安装 CMake 才能构建以下扩展:dlib
为 dlib 构建轮子失败 为 dlib 运行 setup.py clean 无法构建 dlib