keras zca_whitening-没有错误,没有产生输出 [英] keras zca_whitening - no error, no output generated

查看:112
本文介绍了keras zca_whitening-没有错误,没有产生输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用zca_whitening时,我的代码卡在了某个地方,既没有显示任何错误,也没有输出.当我跳过zca_whitening并应用其他转换时,代码可以完美运行.我在这里附上代码片段.如果我在这里做错了任何事情,请帮助我:

While using zca_whitening, my code gets stuck somewhere, neither it shows any error nor the output. When i skip the zca_whitening and apply other transformations, the code runs perfectly. I am attaching the code snippet here. Pl help me if I am doing anything wrong here :

datagen = ImageDataGenerator(zca_whitening=True)
datagen.fit(x_train)

其中>> x_train是一组训练图像(dim = 50 x 64 x 64 x 3).运行datagen.fit后,该代码未显示任何进一步的输出或错误,似乎使该进程运行了无限长的时间.

where >> x_train is the set of training images (dim = 50 x 64 x 64 x 3) . After running datagen.fit, the code shows no further output or error, seems to have the process running for an infinite time period.

另一方面,这些转换效果很好:

on the other hand these transformations work perfectly :

datagen = ImageDataGenerator(rotation_range=0.90,
    width_shift_range=0.2,
    height_shift_range=0.2,
    fill_mode='nearest',
    horizontal_flip=True,
    vertical_flip=True)
datagen.fit(x_train)

这里有什么我想念的吗?

Is there anything I am missing here?

推荐答案

修改x_train以使其具有形状(3, 64, 64).

您可以通过使用以下代码来做到这一点:x_train = x_train.transpose((2,1,0))

You can do that by using the following code: x_train = x_train.transpose((2,1,0))

这主要是由于theano和tensorflow后端之间的切换.检查Keras文档中的dim_order.

This is mainly due to the switching between theano and tensorflow backend. Check dim_order in Keras documentation.

这篇关于keras zca_whitening-没有错误,没有产生输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆