Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Import necessary libraries
- import os
- import json
- import string
- import pandas as pd
- import turicreate as tc
- # Enable the ability to view images in a cell
- %matplotlib inline
- # Helper function that will build our bounding boxes in a way that TuriCreate can work with
- def build_annotations(_tuple):
- label = _tuple[0];
- x_min = _tuple[1][0]; # left x
- x_max = _tuple[1][2]; # right x
- y_min = _tuple[1][1]; # top y
- y_max = _tuple[1][3]; # bottom y
- ret = {"coordinates":
- {
- "x" : (x_min + x_max)/2,
- "y" : (y_min + y_max)/2,
- "width": x_max - x_min,
- "height": y_max - y_min
- },
- "label": label
- }
- return ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement