From e8196a247029c7b62f6cb8a29139f87c40cd8777 Mon Sep 17 00:00:00 2001 From: Ssangam1999 Date: Wed, 3 Jan 2024 20:31:31 +0545 Subject: [PATCH 1/3] modified/input portion --- detect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/detect.py b/detect.py index 5e0c4416a4..29daa1b420 100644 --- a/detect.py +++ b/detect.py @@ -166,7 +166,9 @@ 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/Pictures/2.jpg', 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') From 26bd12aa45ca64118006a7c617294b201cf2ccfa Mon Sep 17 00:00:00 2001 From: Ssangam1999 Date: Wed, 3 Jan 2024 21:04:43 +0545 Subject: [PATCH 2/3] refactored --- detect.py | 1 - experiment/arg.py | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 experiment/arg.py diff --git a/detect.py b/detect.py index 29daa1b420..05adc5238b 100644 --- a/detect.py +++ b/detect.py @@ -167,7 +167,6 @@ def detect(save_img=False): 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='/home/sangam/Pictures/2.jpg', 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') 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 From 18d0d71645b2daac34d9db8c88a123da58f8ffd6 Mon Sep 17 00:00:00 2001 From: Ssangam1999 Date: Thu, 4 Jan 2024 14:16:45 +0545 Subject: [PATCH 3/3] image view --- detect.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/detect.py b/detect.py index 05adc5238b..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,13 +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='/home/sangam/Pictures/2.jpg', help='source') + 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')