Login using Social Account
     Continue with GoogleLogin using your credentials
We shall visualize the images that we have loaded previously.
We shall define the imshow
function to do the same.
Note:
tf.squeeze
removes dimensions of size 1 from the shape of a tensor.We shall define the imshow
function. We shall pass the image and the title as input arguments to the function.
We shall also display the title of the image, if any.
def imshow(image, title=None):
if len(image.shape) > 3:
image = tf.squeeze(image, axis=0)
plt.imshow(image)
if title:
plt.title(title)
Let us display the content and style images side-by-side. Call the imshow
function to display the content and style images.
plt.subplot(1, 2, 1)
<< your code comes here >>(content_image, 'Content Image')
plt.subplot(1, 2, 2)
<< your code comes here >>(style_image, 'Style Image')
Let us also print the shapes of the content and style images using shape
.
print("Content image shape: ", << your code comes here >>)
print("Style image shape: ", << your code comes here >>)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...