In the W2, Transfer learning coding exercises, data augmentation is implemented on an image database imported from tensroflow. I was just wondering how this would be implemented with a dataset of my own computer.
Hi @Kevin_Zhou1, you can do it in the same way. Is there anything that made you feel otherwise?
There is no database of images. Images are stored in a directory (see image_dataset_from_directory)
Here’s an example of how you can perform augmentation with just 1 image (be sure to understand the previous concepts before this):
import tensorflow as tf
from matplotlib.pyplot import imshow
aug_model = tf.keras.Sequential([
tf.keras.layers.RandomBrightness(factor=(.3, .7)),
tf.keras.layers.RandomFlip()
])
image = tf.io.read_file('2.png')
png = tf.io.decode_png(image, channels=3)
augmented = aug_model(png)
1 Like
I thought there was some different format in the directory or something, I’m really new to this so i wasn’t sure. thanks
No worries. I asked because I wanted to make sure I didn’t overlook - if you had time, do give it a try on your computer and feedback here if you find something.
Raymond
1 Like
