I am trying to run this code in Pycharm! and then…on the cmd.exe line
the sample code is located at https://www.pyimagesearch.com/2019/11/25/human-activity-recognition-with-opencv-and-deep-learning/
I understand the perameters --classes --model and --i need to be placed after the python name for it to work. Getting errors how the peramters should be set up on the command line and also in pycharm.
PLEASE help me this is taking WAY to long with also, the other issues I had setting up pycharm!
# USAGE # python human_activity_reco.py --model resnet-34_kinetics.onnx --classes action_recognition_kinetics.txt --input example_activities.mp4 # python human_activity_reco.py --model resnet-34_kinetics.onnx --classes action_recognition_kinetics.txt # import the necessary packages import numpy as np import argparse import imutils import sys import cv2 # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-m", "--model ", required=True, help="path to trained human activity recognition model") ap.add_argument("-c", "--classes ", required=True, help="path to class labels file") ap.add_argument("-i", "--input ", type=str, default="", help="optional path to video file") args = vars(ap.parse_args()) # load the contents of the class labels file, then define the sample # duration (i.e., # of frames for classification) and sample size # (i.e., the spatial dimensions of the frame) CLASSES = open(args["classes"]).read().strip().split("\n") SAMPLE_DURATION = 16 SAMPLE_SIZE = 112 # load the human activity recognition model print("[INFO] loading human activity recognition model...") net = cv2.dnn.readNet(args["model"]) # grab a pointer to the input video stream print("[INFO] accessing video stream...") vs = cv2.VideoCapture(args["input"] if args["input"] else 0) # loop until we explicitly break from it while True: # initialize the batch of frames that will be passed through the # model frames =  # loop over the number of required sample frames for i in range(0, SAMPLE_DURATION): # read a frame from the video stream (grabbed, frame) = vs.read() # if the frame was not grabbed then we've reached the end of # the video stream so exit the script if not grabbed: print("[INFO] no frame read from stream - exiting") sys.exit(0) # otherwise, the frame was read so resize it and add it to # our frames list frame = imutils.resize(frame, width=400) frames.append(frame) # now that our frames array is filled we can construct our blob blob = cv2.dnn.blobFromImages(frames, 1.0, (SAMPLE_SIZE, SAMPLE_SIZE), (114.7748, 107.7354, 99.4750), swapRB=True, crop=True) blob = np.transpose(blob, (1, 0, 2, 3)) blob = np.expand_dims(blob, axis=0) # pass the blob through the network to obtain our human activity # recognition predictions net.setInput(blob) outputs = net.forward() label = CLASSES[np.argmax(outputs)] # loop over our frames for frame in frames: # draw the predicted activity on the frame cv2.rectangle(frame, (0, 0), (300, 40), (0, 0, 0), -1) cv2.putText(frame, label, (10, 25), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (255, 255, 255), 2) # display the frame to our screen cv2.imshow("Activity Recognition", frame) key = cv2.waitKey(1) & 0xFF # if the `q` key was pressed, break from the loop if key == ord("q"): break