Closed JcmeLs closed 7 years ago
image[0] 应该可以解决
In general, numpy array 支持 multi slicing 语法
an_array[:, 10:20, :-10, None]
意思就是取这个数组的第一个维度所有,第二个维度10到20,第三个维度第一个到倒数第11个,第四个维度所有。
@CreatCodeBuild 谢谢,我目前的做法是这样
batch = mnist.train.next_batch(100)
for j in range(100):
image=batch[0][j];
shape=image.shape;
image = image.reshape(28, 28, 1);
image=tf.image.random_flip_left_right(image)
image=tf.image.random_flip_up_down(image)
image=tf.image.random_brightness(image,max_delta=63)
image=tf.image.random_contrast(image,lower=0.2,upper=1.8)
npimage=np.arange(0,784).reshape(28,28,1)
with sess.as_default():
npimage=image.eval()
batch[0][j]=npimage.reshape(shape)
每个batch都这样处理,非常费时。。。就是想问有没有高效的方式 而且发现。。。。好像转出来的数据train不了。。accuracy一直0.098
可以考虑先预处理之后,把数据存起来。使用 scipy io savemat 函数。这样费时也只是一次性的。你也可以将数据分成8组,然后process并行。
On Thu, Feb 23, 2017 at 6:10 PM Jcmels notifications@github.com wrote:
谢谢,我目前的做法是这样
batch = mnist.train.next_batch(100) for j in range(100):
image=batch[0][j]; shape=image.shape; image = image.reshape(28, 28, 1); image=tf.image.random_flip_left_right(image) image=tf.image.random_flip_up_down(image) image=tf.image.random_brightness(image,max_delta=63) image=tf.image.random_contrast(image,lower=0.2,upper=1.8) npimage=np.arange(0,784).reshape(28,28,1) with sess.as_default(): npimage=image.eval() batch[0][j]=npimage.reshape(shape)
每个batch都这样处理,非常费时。。。就是想问有没有高效的方式
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/CreatCodeBuild/TensorFlow-and-DeepLearning-Tutorial/issues/18#issuecomment-282183332, or mute the thread https://github.com/notifications/unsubscribe-auth/AIga8t1J91fklQ4fmDo830f7M_KiLzx3ks5rfjwrgaJpZM4MJrPS .
恩恩,正在做这部分,不过已经不用MNIST做了,用SVHN数据集,原理差不多
教程就是用的 SVHN。祝你好运。
偶然看到,不知道下面的方法能不能解决你的问题,用了tflearn img_aug = ImageAugmentation() img_aug.add_random_rotation(20.0)
x = tflearn.input_data(shape=[None, 224, 224, 3], name='input',data_augmentation=img_aug)
Hi,哲的王
我目前在做Android实时识别这块的APP,目前拿MNIST练手,发现理想环境下使用test data去评估模型,有99%的准确率,然后放在Android上实时识别或者拍照之后再识别,准确度不高,所以我想在train之前做data agumentation,然后发现
Best Regards Jcme Ls