Visual Backprop for TensorFlow
This topic shows you how to generate a Visual Backprop for TensorFlow.
The steps that are covered are:
- Installing OpenCV-Python
- Generating a Visual Backprop for TensorFlow
Ensure that you have:
- Installed MissingLink's SDK as detailed here.
- Installed OpenCV-Python. Installation options are provided below.
- Gone through Integrating MissingLink's SDK with TensorFlow.
- Gone through Setting Class Mappings.
Option 1: Installing OpenCV-Python with pip
If you have set up the system as the documentation has detailed here, you can simply run the command below. Otherwise, go to Option 2.
pip install opencv-python
Option 2: Installing OpenCV-Python based on your environment
Generate Visual Backprop with an image by adding the following code fragment at the end:
session = [CURRENT_SESSION] path = [URI] with missinglink_project.create_experiment() as experiment: experiment.set_properties( input_placeholder=[INPUT_PLACEHOLDER_NAME], output_layer=[OUTPUT_LAYER_NAME] ) experiment.visual_back_prop(path, session)
path: URI of an image. This is the original image.
MissingLink understands that data can be proprietary and has an option for images to be private to only you when you provide MissingLink with a private URL.
For URL, for example: http://l7.alamy.com/zooms/b76d255dd51e493e8c0fd5d5aa85f96f/lumbermill-cp93p7.jpg, MissingLink will not download the image or store it on MissingLink servers. You need to ensure that the URL you have provided is private and can be accessed only from your machine or office.
For a local file starting with "file://" or just a pure path such as "/home/user/image.jpg", MissingLink will download the file and serve it from MissingLink servers.
model: The model in order to run prediction.
input_val(options): Image preprocessed the same way as it would be used to feed to the network. If this is None, MissingLink assumes no preprocessing is needed and just loads an image.
dim_order(options): Dimensions order of the image. Can be one of "nhwc" -- for channel last ordering and "nchw" for channel first ordering. "nchw" is the default.
description(options): A string to display on the console that describes this data point. Can be the image id or any text.
You can find the full updated scriptthat MissingLink has provided using a pre-trained model known as VGG as an example.
You are done generating a Visual Backprop for TensorFlow. Now run the script and check the model on the MissingLink dashboard.