# load the class label names CLASSES = open(args["classes"]).read().strip().split("\n") # if a colors file was supplied, load it from disk if args["colors"]: COLORS = open(args["colors"]).read().strip().split("\n") COLORS = [np.array(c.split(",")).astype("int") for c in COLORS] COLORS = np.array(COLORS, dtype="uint8") # otherwise, we need to randomly generate RGB colors for each class # label else: # initialize a list of colors to represent each class label in # the mask (starting with 'black' for the background/unlabeled # regions) np.random.seed(42) COLORS = np.random.randint(0, 255, size=(len(CLASSES) - 1, 3), dtype="uint8") COLORS = np.vstack([[0, 0, 0], COLORS]).astype("uint8")