This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| plt.figure(figsize=(12, 12)) | |
| plt.subplot(1, 2, 1) | |
| plt.imshow(content_image[0]) | |
| plt.title('Content Image') | |
| plt.subplot(1, 2, 2) | |
| plt.imshow(style_image[0]) | |
| plt.title('Style Image') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| content_image = load_img(content_path) | |
| style_image = load_img(style_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def load_img(path_to_img): | |
| # Reads and outputs the entire contents of the input filename. | |
| img = tf.io.read_file(path_to_img) | |
| # Detect whether an image is a BMP, GIF, JPEG, or PNG, and | |
| # performs the appropriate operation to convert the input | |
| # bytes string into a Tensor of type dtype | |
| img = tf.image.decode_image(img, channels=3) | |
| # Convert image to dtype, scaling (MinMax Normalization) its values if needed. | |
| img = tf.image.convert_image_dtype(img, tf.float32) | |
| # Scale the image using the custom function we created |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def img_scaler(image, max_dim = 256): | |
| # Casts a tensor to a new type. | |
| original_shape = tf.cast(tf.shape(image)[:-1], tf.float32) | |
| # Creates a scale constant for the image | |
| scale_ratio = 4 * max_dim / max(original_shape) | |
| # Casts a tensor to a new type. | |
| new_shape = tf.cast(original_shape * scale_ratio, tf.int32) | |
| # Resizes the image based on the scaling constant generated above | |
| return tf.image.resize(image, new_shape) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| content_path = tf.keras.utils.get_file('photo-1563306406-e66174fa3787', | |
| 'https://images.unsplash.com/photo-1563306406-e66174fa3787') | |
| style_path = tf.keras.utils.get_file('Andy-Warhol--Marilyn-Monroe-Hot-Pink-1967-Andy-Warhol-Poster.jpg', | |
| 'https://product-image.juniqe-production.juniqe.com/media/catalog/product/seo-cache/x800/7/7/776-8-101P-13x18-1/Andy-Warhol--Marilyn-Monroe-Hot-Pink-1967-Andy-Warhol-Poster.jpg') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Name | Main Approach | |
|---|---|---|
| Feedforward Neural Network | Supervised Learning | |
| Convolutional Neural Network | Supervised Learning | |
| Recurrent Neural Network | Supervised Learning | |
| Transformer Networks | Supervised Learning | |
| Autoencoders | Unsupervised Learning | |
| Generative Adversarial Networks | Unsupervised Learning | |
| Deep Recommender Systems | Unsupervised Learning | |
| Self Organizing Maps (SOMs) | Unsupervised Learning | |
| Deep Belief Networks | Supervised and Unsupervised Learning |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !apt-get install --no-install-recommends openmpi-bin libopenmpi-dev libopencv-dev python3-opencv python-opencv | |
| !ln -sf /usr/lib/x86_64-linux-gnu/libmpi_cxx.so /usr/lib/x86_64-linux-gnu/libmpi_cxx.so.1 | |
| !ln -sf /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so.12 | |
| !ln -sf /usr/lib/x86_64-linux-gnu/libmpi.so /usr/lib/x86_64-linux-gnu/libmpi.so.12 | |
| !pip install cntk | |
| import cntk as C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !pip install mxnet | |
| import mxnet as mx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !pip install torch torchvision | |
| import torch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !pip install Keras | |
| import keras |