值错误:尝试获取空序列Kagg的argmax

用户

所以我在一篇关于构建TensorFlow Lite应用程序的教程中遇到了这个问题。在

import re
import numpy as np

output_directory = '/kaggle/working/trained_model'

lst = os.listdir(train)
lst = [l for l in lst if 'model.ckpt-' in l and '.meta' in l]
steps=np.array([int(re.findall('\d+', l)[0]) for l in lst])
last_model = lst[steps.argmax()].replace('.meta', '')
last_model_path = os.path.join(train, last_model)

print(last_model_path)
!python /kaggle/working/models/research/object_detection/export_inference_graph.py \
    --input_type=image_tensor \
    --pipeline_config_path={pipeline_fname} \
    --output_directory={output_directory} \
    --trained_checkpoint_prefix={last_model_path} \
    > /kaggle/working/graph.txt
print('Finished exporting')

错误:

ValueError Traceback (most recent call last) in () 8 lst = [l for l in lst if 'model.ckpt-' in l and '.meta' in l] 9 steps=np.array([int(re.findall('\d+', l)[0]) for l in lst]) ---> 10 last_model = lst[steps.argmax()].replace('.meta', '') 11 last_model_path = os.path.join(train, last_model) 12

ValueError: attempt to get argmax of an empty sequence


已被浏览了3645次
更新日期: 2020-10-22 22:44:41
0 个回答

目前没有回答

最新Python问答

推荐Python问答