Enrollments Open for Online Instructor-Led Training for Big Data Engineering and Machine Learning | Use Coupon END15 for Extra 15% Off

  Enroll Now

Getting the class names

In this section, we will read the coco labels file. This file contains the labels of the object the model was trained against. We will also create a COLORS array which will give a different color for each label. Note that the coco has 90 labels by default.

  • Set label_file to the file path /cxldata/dlcourse/mask_rcnn_model_data/object_detection_classes_coco.txt where the labels are stored. Remember to put quotes (" ") around the path.

    label_file=<< your code comes here >>
  • Get the labels LABELS from the file:

    LABELS = open(label_file).read().strip().split("\n")
  • Randomly generate the colors(the R value, G value and B value) using np.random.randint for each label(thus the size (len(LABELS), 3). These colors will be used to highlight the detected object of that class later.

    COLORS = np.random.<< your code comes here >>(0, 255, size=(len(LABELS), 3), dtype="uint8")
  • Let us have a look at the first 5 classes in the file:


No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...