Path: blob/master/site/en-snapshot/hub/tutorials/boundless.ipynb
25118 views
Copyright 2020 The TensorFlow Hub Authors.
Licensed under the Apache License, Version 2.0 (the "License");
Boundless Colab
Welcome to the Boundless model Colab! This notebook will take you through the steps of running the model on images and visualize the results.
Overview
Boundless is a model for image extrapolation. This model takes an image, internally masks a portion of it (1/2, 1/4, 3/4) and completes the masked part. For more details refer to Boundless: Generative Adversarial Networks for Image Extension or the model documentation on TensorFlow Hub.
Imports and Setup
Lets start with the base imports.
Reading image for input
Lets create a util method to help load the image and format it for the model (257x257x3). This method will also crop the image to a square to avoid distortion and you can use with local images or from the internet.
Visualization method
We will also create a visuzalization method to show the original image side by side with the masked version and the "filled" version, both generated by the model.
Loading an Image
We will load a sample image but fell free to upload your own image to the colab and try with it. Remember that the model have some limitations regarding human images.
Selecting a model from TensorFlow Hub
On TensorFlow Hub we have 3 versions of the Boundless model: Half, Quarter and Three Quarters. In the following cell you can chose any of them and try on your image. If you want to try with another one, just chose it and execute the following cells.
Now that we've chosen the model we want, lets load it from TensorFlow Hub.
Note: You can point your browser to the model handle to read the model's documentation.
Doing Inference
The boundless model have two outputs:
The input image with a mask applied
The masked image with the extrapolation to complete it
we can use these two images to show a comparisson visualization.