Skip to content

Instantly share code, notes, and snippets.

@masouduut94
Created July 10, 2020 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masouduut94/59cc916d6b14258442edab2956a0caac to your computer and use it in GitHub Desktop.
Save masouduut94/59cc916d6b14258442edab2956a0caac to your computer and use it in GitHub Desktop.
class Bbox(BaseJsonParser):
"""
This class keeps the information of each bounding box in the frame.
"""
def __init__(self, bbox_id, top, left, width, height):
self.labels = []
self.bbox_id = bbox_id
self.top = top
self.left = left
self.width = width
self.height = height
def add_label(self, category, confidence):
# adds category and confidence only if top_k is not exceeded.
self.labels.append(Label(category, confidence))
def labels_full(self, value):
return len(self.labels) == value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment