Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么;I tensorflow/compiler/xla/service/service.cc:176]StreamExecutor设备(0):主机,默认版本";can';完不成_Tensorflow_Machine Learning_Auto Keras - Fatal编程技术网

为什么;I tensorflow/compiler/xla/service/service.cc:176]StreamExecutor设备(0):主机,默认版本";can';完不成

为什么;I tensorflow/compiler/xla/service/service.cc:176]StreamExecutor设备(0):主机,默认版本";can';完不成,tensorflow,machine-learning,auto-keras,Tensorflow,Machine Learning,Auto Keras,这是我的数据。它有7幅图像: 我使用autokeras进行培训: import tensorflow as tf import numpy as np import autokeras as ak from tensorflow.keras.preprocessing import image BATCH_SIZE = 32 IMG_HEIGHT = 224 IMG_WIDTH = 224 train_data_dir = "E:\\DemoTensorflow\\NhanDien

这是我的数据。它有7幅图像:

我使用
autokeras
进行培训:

import tensorflow as tf
import numpy as np
import autokeras as ak
from tensorflow.keras.preprocessing import image

BATCH_SIZE = 32
IMG_HEIGHT = 224
IMG_WIDTH = 224
train_data_dir = "E:\\DemoTensorflow\\NhanDienDoiTuong\\Data\\Traintest"


def preprocess(img):
    img = image.array_to_img(img, scale=False)
    img = img.resize((IMG_WIDTH, IMG_HEIGHT))
    img = image.img_to_array(img)
    return img / 255.0


image_generator = tf.keras.preprocessing.image.ImageDataGenerator(
    rescale=1.0 / 255,
    horizontal_flip=True,
    validation_split=0.2,
    preprocessing_function=preprocess,
)

train_generator = image_generator.flow_from_directory(
    directory=train_data_dir,
    batch_size=BATCH_SIZE,
    shuffle=True,
    target_size=(IMG_HEIGHT, IMG_WIDTH),
    subset="training",
)

val_generator = image_generator.flow_from_directory(
    directory=train_data_dir,
    batch_size=BATCH_SIZE,
    shuffle=True,
    # class_mode="categorical",
    target_size=(IMG_HEIGHT, IMG_WIDTH),
    subset="validation",
)


def callable_iterator(generator):
    for img_batch, targets_batch in generator:
        yield img_batch, targets_batch


train_dataset = tf.data.Dataset.from_generator(
    lambda: callable_iterator(train_generator),
    output_types=(tf.float32, tf.int8),
    output_shapes=(
        tf.TensorShape([None, 224, 224, 3]),
        tf.TensorShape([None, 2]),
    ),
)
val_dataset = tf.data.Dataset.from_generator(lambda: callable_iterator(val_generator),output_types=(tf.float32, tf.float32))

clf = ak.ImageClassifier(max_trials=10)
clf.fit(train_dataset, epochs=10)
print(clf.evaluate(val_dataset))
结果:执行以下操作时无法完成: 它在该命令处挂起很长时间:
StreamExecutor设备(0):主机,默认版本

为什么我不能完成我的训练


我的操作系统是Win7、python 3.8、tensorflow 2.3、autokeras 1.0.8

忽略这些信息性消息,它们在这里不一定相关(除非您确实想在GPU上训练)。相反,看看任务管理器;如果Python进程占用了您100%的CPU,那么很可能只是在努力训练。我检查了CPU,它只占用了大约12%。我的数据非常小,所以我认为它会非常快。