我正在研究Keras封裝進行深度學習,並在https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py上找到了一個很好的代碼示例,它很好地集成了圖像預處理(例如旋轉和移位)。我想知道 - 在預處理之後是否容易繪製訓練圖像以觀察這些旋轉和換檔的影響?圖像繪圖 - 處理後
1
A
回答
0
通過給數據生成器的flow()
函數提供save_to_dir='path_to_dir'
,可以將生成的圖像保存到磁盤。
1
是的,可以繪製圖像。例如在MNIST數據集的情況下:
from keras.datasets import mnist
from keras.preprocessing.image import ImageDataGenerator
from matplotlib import pyplot
(X_train, y_train), (X_test, y_test) = mnist.load_data()
X_train = X_train.reshape(X_train.shape[0], 1, 28, 28)
X_test = X_test.reshape(X_test.shape[0], 1, 28, 28)
X_train = X_train.astype('float32')
X_test = X_test.astype('float32')
datagen = ImageDataGenerator(horizontal_flip=True, vertical_flip=True)
datagen.fit(X_train)
for X_batch, y_batch in datagen.flow(X_train, y_train, batch_size=9):
# grid of 3x3 images
for i in range(0, 9):
pyplot.subplot(330 + 1 + i)
pyplot.imshow(X_batch[i].reshape(28, 28), cmap=pyplot.get_cmap('gray'))
pyplot.show()
break
欲瞭解更多詳情,請參閱this鏈接。
相關問題
- 1. 繪圖處理中抽搐的圖像
- 2. CMS的圖像後處理
- 3. 事件處理繪製的圖像上
- 4. Android:後期處理繪製視圖
- 5. 圖像處理
- 6. 圖像處理
- 7. 圖像處理
- 8. 圖像處理
- 9. 圖像處理
- 10. 圖像處理
- 11. 圖像處理
- 12. 圖像處理
- 13. 圖像處理
- 14. 用Tkinter處理繪圖
- 15. 處理繪圖問題
- 16. 處理圖像視圖
- 17. 圖像處理/地圖
- 18. 圖案圖像處理
- 19. 圖像處理蟒
- 20. Python圖像處理
- 21. OCR圖像處理
- 22. Modis圖像處理
- 23. PHP圖像處理
- 24. 圖像處理PHP
- 25. OpenCV圖像處理
- 26. jQuery圖像處理
- 27. MATLAB(圖像處理)
- 28. JPG圖像處理
- 29. 圖像處理庫
- 30. YUV圖像處理