python使用yolo来进行目标检测与识别代码
代码语言:python
所属分类:人工智能
代码描述:python使用yolo来进行目标检测与识别代码,可以识别人和物
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
import cv2
#import argparse
import numpy as np
import sys
#parser = argparse.ArgumentParser()
#parser.add_argument('--input', help='Path to input image.')
#args = parser.parse_args()
# Minimum confidence threshold. Increasing this will improve false positives but will also reduce detection rate.
min_confidence=0.14
model = '/data/wwwroot/default/model/yolov2.weights'
config = '/data/wwwroot/default/model/yolov2.cfg'
#Load names of classes
classes = None
with open('/data/wwwroot/default/model/labels.txt', 'rt') as f:
classes = f.read().rstrip('\n').split('\n')
#print(classes)
# Load weights and construct graph
net = cv2.dnn.readNetFromDarknet(config, model)
net.setPreferableBac.........完整代码请登录后点击上方下载按钮下载查看
网友评论0