weixin_45536989
weixin_45536989
采纳率40%
2019-08-26 01:11

InvalidArgumentError: Failed to create a directory: log/C:; Invalid argument这是什么原因呀

tensorflow.python.framework.errors_impl.InvalidArgumentError: Failed to create a directory: log/C:; Invalid argument
这个代码我改了一点就运行不了了,提示无法创建文件夹是什么原因?
我在123文件夹里建立了TO文件夹里面也建立了log 但是还是报这个错误

# train_model.py

import numpy as np
from alexnet import alexnet
WIDTH = 214
HEIGHT = 132
LR = 1e-3
EPOCHS = 10
MODEL_NAME = 'C:/Users/Administrator/Desktop/123/pygta5-car-fast-{}-{}-{}-epochs-300K-data.model'.format(LR, 'alexnetv2',EPOCHS)

model = alexnet(WIDTH, HEIGHT, LR)

hm_data = 22
for i in range(EPOCHS):
    for i in range(1,hm_data+1):
        train_data = np.load('C:/Users/Administrator/Desktop/123/training_data-{}-balanced.npy'.format(i))

        train = train_data[:-100]
        test = train_data[-100:]

        X = np.array([i[0] for i in train]).reshape(-1,WIDTH,HEIGHT,1)
        Y = [i[1] for i in train]

        test_x = np.array([i[0] for i in test]).reshape(-1,WIDTH,HEIGHT,1)
        test_y = [i[1] for i in test]

        model.fit({'input': X}, {'targets': Y}, n_epoch=1, validation_set=({'input': test_x}, {'targets': test_y}), 
            snapshot_step=500, show_metric=True, run_id=MODEL_NAME)

        model.save(MODEL_NAME)



# tensorboard --logdir=foo:C:/path/to/log


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • caozhy 回答这么多问题就耍赖把我的积分一笔勾销了 2年前

    采纳率太差,如果希望得到更多帮助,请及时采纳

    log路径的输出为止,不要写 c:\,因为是相对路径,而冒号是不允许的。

    点赞 2 评论 复制链接分享