Skip to content

Instantly share code, notes, and snippets.

@pranjalsatija
Last active July 9, 2018 02:12
Show Gist options
  • Save pranjalsatija/a2a37dc8f8f270b47dcf00265dddd373 to your computer and use it in GitHub Desktop.
Save pranjalsatija/a2a37dc8f8f270b47dcf00265dddd373 to your computer and use it in GitHub Desktop.
import os
import turicreate as tc
path = '../' # The path to the root of your project directory.
sf_path = os.path.join(path, 'data.sframe') # The path to load the SFrame from. See `gen_sframe.py` for more.
data = tc.SFrame(sf_path) # The training data for our model.
# This takes the first 50 rows from the SFrame we just loaded from disk and drops the rest of it. We do this so the
# visualization doesn't take too long to load and run.
data = data.head(50)
# This removes the path and raw image from data. When visualizing the data, we only want to see our supplied annotations
# and the bounding boxes for detected objects. This change won't affect the SFrame located on disk at sf_path, just
# the in-memory representation of it.
del data['path']
# This draws bounding boxes on the "image" column of data, which makes it easy to visualize the raw data.
data['image'] = tc.object_detector.util.draw_bounding_boxes(data['image'], data['annotations'])
# This will open a new window on your computer so you can visualize the data.
data.explore()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment