我正在研究实时服装检测。所以我从 GitHub 借用了这样的代码: https: //github.com/rajkbharali/Real-time-clothes-detection 但是(H, W) = frame.shape[:2]
:最后一行出现以下错误。我应该在哪里修复它?
from time import sleep
import cv2 as cv
import argparse
import sys
import numpy as np
import os.path
from glob import glob
import imutils
from imutils.video import WebcamVideoStream
from imutils.video import FPS
from google.colab import drive
drive.mount('/content/drive')
%cd /content/drive/My Drive/experiment/Yolo_mark-master/x64/Release/
Labels = []
classesFile1 = "data/obj.names";
with open(classesFile1, 'rt') as f:
Labels = f.read().rstrip('\n').split('\n')
np.random.seed(42)
COLORS = np.random.randint(0, 255, size=(len(Labels), 3), dtype="uint8")
weightsPath = "obj_4000.weights"
configPath = "obj.cfg"
net1 = cv.dnn.readNetFromDarknet(configPath, weightsPath)
net1.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
net1.setPreferableTarget(cv.dnn.DNN_TARGET_CPU)
image = WebcamVideoStream(src=0).start()
fps = FPS().start()
#'/home/raj/Documents/yolov3-Helmet-Detection-master/safety.mp4'
#while fps._numFrames<100:
while True:
#for fn in glob('images/*.jpg'):
frame = image.read()
#frame = imutils.resize(frame,width=500)
(H, W) = frame.shape[:2]
萧十郎
相关分类