小编Per*_*azi的帖子

获取model.predict_generator的测试准确性

我正在调用model.predict_generator()用于测试数据集的预测方法。我的问题是如何获取测试准确性?以下是我的代码行:

predictions = model.predict_generator(test_images, steps=3,  verbose=0)
Run Code Online (Sandbox Code Playgroud)

test_iamges在参数predict_generator功能批量数据从本地磁盘通过调用检索ImageDataGenerator

任何指导将不胜感激。

谢谢

python keras

5
推荐指数
1
解决办法
1762
查看次数

Ftensorflow/stream_executor/cuda/cuda_dnn.cc:522]检查失败

我正在张量流中训练我的模型。经过一些迭代后,我得到以下异常:

F tensorflow/stream_executor/cuda/cuda_dnn.cc:522] 检查失败: cudnnSetTensorNdDescriptor(handle_.get(), elem_type, nd, dims.data(), strides.data()) == CUDNN_STATUS_SUCCESS (3 vs. 0)batch_descriptor :{计数:1 feature_map_count:1088 空间:63 0 value_min:0.000000 value_max:0.000000 布局:BatchDepthYX}

问题不在于 cuda 库,因为相同的代码适用于其他数据集。这可能是什么原因呢?

tensorflow

5
推荐指数
0
解决办法
1738
查看次数

将灰度图像内容复制到 3 个通道

我正在使用ImageDataGenerator. 我需要将每个灰度图像的内容复制到 3 个通道中。我尝试了以下代码,但似乎不起作用:

def grayscale_to_rgb(images, channel_axis=-1):
images= K.expand_dims(images, axis=channel_axis)
tiling = [1] * 4    # 4 dimensions: B, H, W, C
tiling[channel_axis] *= 3
images= K.tile(images, tiling)
return images




train_images_orign= grayscale_to_rgb(train_images_orign)
valid_images_orign= grayscale_to_rgb(valid_images_orign)
test_images_orign= grayscale_to_rgb(test_images_orign)

x_train, y_train = next(train_images_orign)
x_valid, y_valid = next(valid_images_orign)
x_test, y_test = next(test_images_orign)
Run Code Online (Sandbox Code Playgroud)

我应该朝哪个方向来实现这一目标?

python deep-learning keras tensorflow

3
推荐指数
1
解决办法
4479
查看次数

标签 统计

keras ×2

python ×2

tensorflow ×2

deep-learning ×1