我希望在JupyterNotebook上运行some Tensorflow code。
如果在终端上运行它,那么上面的链接就会给出如下指令:
# Load the model
facenet.load_model(args.model)
问题:如何在Jupyter笔记本上运行它?谢谢 例如,
args.model
只需将~/models/facenet/20170512-110547
替换为# Load the model
facenet.load_model('~/models/facenet/20170512-110547')
usage: ipykernel_launcher.py [-h] [--lfw_batch_size LFW_BATCH_SIZE]
[--image_size IMAGE_SIZE] [--lfw_pairs LFW_PAIRS]
[--lfw_file_ext {jpg,png}]
[--lfw_nrof_folds LFW_NROF_FOLDS]
lfw_dir model
ipykernel_launcher.py: error: too few arguments
sys.argv
Out[5]:
['/anaconda/envs/tensorflow/lib/python2.7/site-packages/ipykernel_launcher.py',
'-f',
'/Users/my_name/Library/Jupyter/runtime/kernel-770c12c9-8fbe-44f7-91dd-4b0a5c5d7537.json']
会给出错误
if (regNumber.equals(incorrect)) {
System.out.println("Incorrect!");
continue;
} else {
System.out.println("Correct!");
}
答案 0 :(得分:0)
好的,简单的解决方案...... 只需在给定的GitHub建议的终端上运行它,同时打印出终端上的sys.argv
sys.argv = ['src/validate_on_lfw.py', '/Users/../datasets/lfw/lfw_mtcnnpy_160', '/Users/../models/facenet/20170512-110547']
然后在def parse_arguments(argv)
中的JupyterNotebook中使用sys.argv的这些值作为默认值,并且它有效