Skip to content

Instantly share code, notes, and snippets.

@Proteusiq
Last active March 13, 2021 08:59
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 Proteusiq/395e7736dead4e41f394c86aa0cf7b33 to your computer and use it in GitHub Desktop.
Save Proteusiq/395e7736dead4e41f394c86aa0cf7b33 to your computer and use it in GitHub Desktop.
from bounding_box import bounding_box as bb
names = [
"person",
"bicycle",
"car",
"motorcycle",
"airplane",
"bus",
"train",
"truck",
"boat",
"traffic light",
"fire hydrant",
"stop sign",
"parking meter",
"bench",
"bird",
"cat",
"dog",
"horse",
"sheep",
"cow",
"elephant",
"bear",
"zebra",
"giraffe",
"backpack",
"umbrella",
"handbag",
"tie",
"suitcase",
"frisbee",
"skis",
"snowboard",
"sports ball",
"kite",
"baseball bat",
"baseball glove",
"skateboard",
"surfboard",
"tennis racket",
"bottle",
"wine glass",
"cup",
"fork",
"knife",
"spoon",
"bowl",
"banana",
"apple",
"sandwich",
"orange",
"broccoli",
"carrot",
"hot dog",
"pizza",
"donut",
"cake",
"chair",
"couch",
"potted plant",
"bed",
"dining table",
"toilet",
"tv",
"laptop",
"mouse",
"remote",
"keyboard",
"cell phone",
"microwave",
"oven",
"toaster",
"sink",
"refrigerator",
"book",
"clock",
"vase",
"scissors",
"teddy bear",
"hair drier",
"toothbrush",
]
labels = {float(index): label.title() for index, label in enumerate(names)}
def label_bbbox(prediction, frame, color='blue'):
x, y, w, h, score, label = prediction
bb.add(frame, x, y, w, h, f"{labels[label]} {score:.2f}", color)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment