从Facenet恢复检查点,没有发现偏见

时间:2018-06-07 14:31:38

标签: python tensorflow machine-learning restore

我正在使用FaceNet repository,我正在尝试使用<script type="text/javascript"> $(document).ready(function () { $("#Productslist").change(function () { debugger; var selectedIndex = $(this).val(); var divH = document.getElementById(selectedIndex); if (selectedIndex > 0) { $.ajax( { url: '/Inventory/ViewProduct', type: 'GET', data: { ProductID: selectedIndex }, contentType: 'application/json; charset=utf-8', success: function (data) { /// }, error: function () { alert("error"); } }); } else { divH.style.visibility = 'hidden'; // Hide } }); }); </script> 恢复预训练模型的权重和偏差。

当我尝试恢复模型时,我总是遇到同样的错误:

=filter(A:A,countif(C:C,A:A)=0)

似乎找到了正确的文件路径,但是当它尝试加载模型时,会出现一些权重和偏差的问题。

我使用的代码如下:

tf.train.Saver

如您所见,张量通过NotFoundError (see above for traceback): Key InceptionResnetV1/Block8/Branch_0/Conv2d_1x1/biases not found in checkpoint [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]] end_point打印,import tensorflow as tf import cv2 import numpy as np from model.inception_resnet_v1 import inception_resnet_v1 as resnet_bottleneck # from model.inception_resnet_v1 import inference as resnet_logits from tensorflow.python.tools import inspect_checkpoint as chkp def main(): with tf.Graph().as_default(): # Load an image into a numpy array, and expand the dimension to the correct one, based on the # inception_resNet model. img = cv2.imread('/home/uc3m1/Documentos/BQ/modelos/facenet-master/src/datasets/dataset_prueba/Tiger_Woods' '/Tiger_Woods_0002.png') img = np.expand_dims(img, axis=0) img = img.astype(np.float32) # Based on FaceNet, extracting the logits and end_points logits, end_points = resnet_bottleneck(img, 1) # Initializers init_global = tf.initializers.global_variables() init_local = tf.initializers.local_variables() # Checking if the checkpoints tensors chkp.print_tensors_in_checkpoint_file('/home/uc3m1/PycharmProjects/siameseFaceNet/weights/model-20180408' '-102900.ckpt-90', tensor_name='', all_tensors=False, all_tensor_names=True) # Create a saver saver = tf.train.Saver(tf.global_variables()) with tf.Session() as sess: sess.run(init_global) sess.run(init_local) # Restore the pretrained model from FaceNet saver.restore(sess, '/home/uc3m1/PycharmProjects/siameseFaceNet/weights/model-20180408-102900.ckpt-90') print(sess.run(end_points["PreLogitsFlatten"]).shape) if __name__ == '__main__': main() 确实未在模型中定义。我真的不知道如何添加这种偏见,或者如何正确加载它。

有谁知道原因?

0 个答案:

没有答案