This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#%% Load YOLOv3 COCO weights, configs and class IDs | |
# Import class names | |
with open('yolov3/coco.names', 'rt') as f: | |
classes = f.read().rstrip('\n').split('\n') | |
colors = np.random.randint(0, 255, (len(classes), 3)) | |
# Give the configuration and weight files for the model and load the network using them | |
cfg = 'yolov3/yolov3.cfg' | |
weights = 'yolov3/yolov3.weights' | |
# Load model | |
model = cv2.dnn.readNetFromDarknet(cfg, weights) | |
# Extract names from output layers | |
layersNames = model.getLayerNames() | |
outputNames = [layersNames[i[0] - 1] for i in model.getUnconnectedOutLayers()] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment