因此,我遵循了一个教程来构建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跟踪(最近的呼叫 最后)在() 8 lst = [如果l中的'model.ckpt-'和l中的'.meta',则l中的l表示l 9个步骤= np.array([l(l.st的int(re.findall('\ d +',l)[0])]]) ---> 10个last_model = lst [steps.argmax()]。replace('。meta','') 11 last_model_path = os.path.join(train,last_model) 12
ValueError:尝试获取空序列的argmax