InvalidArgumentError:无法创建NewWriteableFile:文件名,目录名称或卷标签语法不正确。 ;未知错误

时间:2019-11-13 17:46:40

标签: python-3.x tensorflow keras deep-learning tensorboard

我正在尝试训练keggle猫和狗的图像数据集。我需要看张量板输出。但它有一个错误

import numpy as np
from tensorflow.keras.datasets import cifar10
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D
from tensorflow.keras.callbacks import TensorBoard
import pickle
import time
import datetime

tensorboard = TensorBoard(log_dir=f".\\logs\\MODEL\\", histogram_freq=1, write_grads=True)

X = pickle.load(open("X.pickle", "rb"))
y = np.asarray(pickle.load(open("y.pickle", "rb")))

X = X/255.0

model = Sequential()
model.add(Conv2D(64, (3,3), input_shape = X.shape[1:]))
model.add(Activation("relu"))
model.add(MaxPooling2D(pool_size=(2,2)))

model.add(Conv2D(64, (3,3)))
model.add(Activation("relu"))
model.add(MaxPooling2D(pool_size=(2,2)))

model.add(Flatten())
model.add(Dense(64))

model.add(Dense(1))
model.add(Activation('sigmoid'))

model.compile(loss="sparse_categorical_crossentropy", optimizer="adam", metrics=['accuracy'])
model.fit(X, y, batch_size=32, epochs=3, validation_split=0.3, callbacks=[tensorboard])

这是错误消息

<ipython-input-52-2af34454ac99> in <module>
     33 
     34 model.compile(loss="sparse_categorical_crossentropy", optimizer="adam", metrics=['accuracy'])
---> 35 model.fit(X, y, batch_size=32, epochs=3, validation_split=0.3, callbacks=[tensorboard])
     36 
     37 

InvalidArgumentError: Failed to create a NewWriteableFile: .\logs\MODEL\train/events.out.tfevents.1573665973.????.5560.13886.v2 : The filename, directory name, or volume label syntax is incorrect.
; Unknown error
    Creating writable file .\logs\MODEL\train/events.out.tfevents.1573665973.????.5560.13886.v2
    Could not initialize events writer. [Op:CreateSummaryFileWriter]

我正在使用tesorflow版本2 jupyter笔记本

0 个答案:

没有答案