diff --git a/detect.py b/detect.py index 5e0c4416a4..7652c8b01b 100644 --- a/detect.py +++ b/detect.py @@ -134,7 +134,7 @@ def detect(save_img=False): # Stream results if view_img: cv2.imshow(str(p), im0) - cv2.waitKey(1) # 1 millisecond + cv2.waitKey(0) # 1 millisecond # Save results (image with detections) if save_img: @@ -166,12 +166,13 @@ def detect(save_img=False): if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--weights', nargs='+', type=str, default='yolov7.pt', help='model.pt path(s)') - parser.add_argument('--source', type=str, default='inference/images', help='source') # file/folder, 0 for webcam + parser.add_argument('--source', type=str, default='/home/sangam/Downloads/WhatsApp Video 2024-01-03 at 4.10.44 PM.mp4', help='source') + # parser.add_argument('--source', type=str, default='inference/images', help='source') # file/folder, 0 for webcam parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)') parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold') parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS') parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') - parser.add_argument('--view-img', action='store_true', help='display results') + parser.add_argument('--view-img', action='store_true',default=True,help='display results') parser.add_argument('--save-txt', action='store_true', help='save results to *.txt') parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels') parser.add_argument('--nosave', action='store_true', help='do not save images/videos') diff --git a/experiment/arg.py b/experiment/arg.py new file mode 100644 index 0000000000..5ebd63388a --- /dev/null +++ b/experiment/arg.py @@ -0,0 +1,14 @@ +import argparse +parser = argparse.ArgumentParser() +parser.add_argument("square", type=int, + help="display a square of a given number") +parser.add_argument("-v", "--verbosity", type=int, + help="increase output verbosity") +args = parser.parse_args() +answer = args.square**2 +if args.verbosity == 2: + print(f"the square of {args.square} equals {answer}") +elif args.verbosity == 1: + print(f"{args.square}^2 == {answer}") +else: + print(answer) \ No newline at end of file