训练easypr时出错
stq054188 opened this issue · 2 comments
测试了一下下载的模型,除了demo里面的test.jpg效果可以,很多其他车牌图片会出问题,想自己训练,但是训练easypr时出错,我的环境win10, python3.5.1, tensorflow 1.10,下面是训练指令
python ./models/train_net.py --data_dir data/easypr_train_data/chars --output_dir output/chars --batch_size 32 --lr 0.01 --net char --epoch 10
报错信息:
Traceback (most recent call last):
File "./models/train_net.py", line 83, in
train.train(dataset_train, dataset_val)
File "C:\Users\A4080599\Desktop\EasyPR-python-master\models\easypr\cnn_train.py", line 64, in train
tf.train.write_graph(self.sess.graph_def, model_dir, 'model.pb', False)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\graph_io.py", line 66, in write_graph
if not file_io.file_exists(logdir) and not logdir.startswith('gs:'):
File "C:\Python35\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 260, in file_exists
pywrap_tensorflow.FileExists(compat.as_bytes(filename), status)
File "C:\Python35\lib\site-packages\tensorflow\python\util\compat.py", line 61, in as_bytes
(bytes_or_text,))
TypeError: Expected binary or unicode string, got WindowsPath('output/chars_20200402T0903/models')
@SunskyF请问有什么思路建议吗?谢谢
我猜测是因为用了from pathlib import Path的原因,他希望传进去的是个string,可以直接使用string或者取出string
我猜测是因为用了from pathlib import Path的原因,他希望传进去的是个string,可以直接使用string或者取出string
非常感谢,是您说的原因,我改成string就可以了
# from pathlib import Path
self.log_dir = '{}_{:%Y%m%dT%H%M}'.format(params['log_dir'], now)
train_writer = tf.summary.FileWriter(str(self.log_dir + "/summary" + "/train"), self.sess.graph) test_writer = tf.summary.FileWriter(str(self.log_dir + "/summary" + "/test")) model_dir = self.log_dir + '/models'