1.下载yolov4-tiny.cfg和yolov4-tiny.cfg
2.opencv dnn调用代码
import cv2 as cv
import numpy as np
yolo_tiny_model = "yolov4-tiny.weights";
yolo_tiny_cfg = "yolov4-tiny.cfg";
# Load names of classes
classes = None
with open("coco.txt", 'rt') as f:
classes = f.read().rstrip('\n').split('\n')
# load tensorflow model
net = cv.dnn.readNetFromDarknet(yolo_tiny_cfg, yolo_tiny_model)
# set back-end
net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
net.setPreferableTarget(cv.dnn.DNN_TARGET_CPU)
image = cv.imread('pedestrian_02.png')
image = c