在Jupyter notebook运行python,结果报告错误DuplicateFlagError:
---------------------------------------------------------------------------
DuplicateFlagError Traceback (most recent call last)
~\MyPythonWork\0源码\slim\download_and_convert_data.py in <module>
53 'dataset_name',
54 None,
---> 55 'The name of the dataset to convert, one of "cifar10", "flowers", "mnist".')
56
57 tf.app.flags.DEFINE_string(
这个需要参考:
https://www.zhihu.com/question/275157176/answer/439254148
记得在程序的开始清除flags就可以了,具体代码如下:
def del_all_flags(FLAGS):
for keys in [keys for keys in FLAGS._flags()]:
FLAGS.__delattr__(keys)
del_all_flags(tf.flags.FLAGS)