Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,6 +29,7 @@ def detect(img,model):
|
|
29 |
parser = argparse.ArgumentParser()
|
30 |
parser.add_argument('--weights', nargs='+', type=str, default=model+".pt", help='model.pt path(s)')
|
31 |
parser.add_argument('--source', type=str, default='Inference/', help='source') # file/folder, 0 for webcam
|
|
|
32 |
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
|
33 |
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
|
34 |
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
@@ -44,14 +45,12 @@ def detect(img,model):
|
|
44 |
parser.add_argument('--name', default='exp', help='save results to project/name')
|
45 |
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
|
46 |
parser.add_argument('--trace', action='store_true', help='trace model')
|
47 |
-
|
48 |
-
if model == "yolov7":
|
49 |
-
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
|
50 |
-
if model == "yolov7-e6e" or "yolov7-e6":
|
51 |
-
parser.add_argument('--img-size', type=int, default=1280, help='inference size (pixels)')
|
52 |
opt = parser.parse_args()
|
53 |
img.save("Inference/test.jpg")
|
54 |
-
|
|
|
|
|
|
|
55 |
save_img = True # save inference images
|
56 |
webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
|
57 |
('rtsp://', 'rtmp://', 'http://', 'https://'))
|
|
|
29 |
parser = argparse.ArgumentParser()
|
30 |
parser.add_argument('--weights', nargs='+', type=str, default=model+".pt", help='model.pt path(s)')
|
31 |
parser.add_argument('--source', type=str, default='Inference/', help='source') # file/folder, 0 for webcam
|
32 |
+
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
|
33 |
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
|
34 |
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
|
35 |
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
|
|
45 |
parser.add_argument('--name', default='exp', help='save results to project/name')
|
46 |
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
|
47 |
parser.add_argument('--trace', action='store_true', help='trace model')
|
|
|
|
|
|
|
|
|
|
|
48 |
opt = parser.parse_args()
|
49 |
img.save("Inference/test.jpg")
|
50 |
+
if model == "yolov7":
|
51 |
+
source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size=640, opt.trace
|
52 |
+
if model == "yolov7-e6e" or "yolov7-e6":
|
53 |
+
source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size=1280, opt.trace
|
54 |
save_img = True # save inference images
|
55 |
webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
|
56 |
('rtsp://', 'rtmp://', 'http://', 'https://'))
|