Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_labels(labels_path):
- # load the COCO class labels our YOLO model was trained on
- #labelsPath = os.path.sep.join([yolo_path, "yolo_v3/coco.names"])
- lpath=os.path.sep.join([yolo_path, labels_path])
- LABELS = open(lpath).read().strip().split("\n")
- return LABELS
- def get_colors(LABELS):
- # initialize a list of colors to represent each possible class label
- np.random.seed(42)
- COLORS = np.random.randint(0, 255, size=(len(LABELS), 3),dtype="uint8")
- return COLORS
- def get_weights(weights_path):
- # derive the paths to the YOLO weights and model configuration
- weightsPath = os.path.sep.join([yolo_path, weights_path])
- return weightsPath
- def get_config(config_path):
- configPath = os.path.sep.join([yolo_path, config_path])
- return configPath
- def load_model(configpath,weightspath):
- # load our YOLO object detector trained on COCO dataset (80 classes)
- print("[INFO] loading YOLO from disk...")
- net = cv2.dnn.readNetFromDarknet(configpath, weightspath)
- return net
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement