Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,7 +33,7 @@ for i, url in enumerate(file_urls):
|
|
| 33 |
)
|
| 34 |
|
| 35 |
|
| 36 |
-
model = YOLO('best.
|
| 37 |
path = [['image_0.jpg'], ['image_1.jpg'], ['image_2.jpg'], ['image_3.jpg']]
|
| 38 |
|
| 39 |
# path = [['IMG_7612.JPG'], ['IMG_7678.JPG'], ['all_33.jpg'], ['all_80.jpg'],
|
|
@@ -49,7 +49,7 @@ classes = ['alligator_cracking', 'longitudinal_cracking', 'potholes', 'ravelling
|
|
| 49 |
|
| 50 |
def show_preds_image(image_path):
|
| 51 |
image = cv2.imread(image_path)
|
| 52 |
-
outputs = model.predict(source=image_path, agnostic_nms=True, conf=0.25, iou=0.4, imgsz=
|
| 53 |
results = outputs[0].cpu().numpy()
|
| 54 |
|
| 55 |
re_boxes = results.boxes.data.tolist()
|
|
@@ -117,7 +117,7 @@ def show_preds_video(video_path):
|
|
| 117 |
ret, frame = cap.read()
|
| 118 |
if ret:
|
| 119 |
frame_copy = frame.copy()
|
| 120 |
-
outputs = model.predict(source=frame, agnostic_nms=True, conf=0.25, iou=0.4, imgsz=
|
| 121 |
results = outputs[0].cpu().numpy()
|
| 122 |
re_boxes = results.boxes.data.tolist()
|
| 123 |
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
|
| 36 |
+
model = YOLO('best.pt', task='detect')
|
| 37 |
path = [['image_0.jpg'], ['image_1.jpg'], ['image_2.jpg'], ['image_3.jpg']]
|
| 38 |
|
| 39 |
# path = [['IMG_7612.JPG'], ['IMG_7678.JPG'], ['all_33.jpg'], ['all_80.jpg'],
|
|
|
|
| 49 |
|
| 50 |
def show_preds_image(image_path):
|
| 51 |
image = cv2.imread(image_path)
|
| 52 |
+
outputs = model.predict(source=image_path, agnostic_nms=True, conf=0.25, iou=0.4, imgsz=640)
|
| 53 |
results = outputs[0].cpu().numpy()
|
| 54 |
|
| 55 |
re_boxes = results.boxes.data.tolist()
|
|
|
|
| 117 |
ret, frame = cap.read()
|
| 118 |
if ret:
|
| 119 |
frame_copy = frame.copy()
|
| 120 |
+
outputs = model.predict(source=frame, agnostic_nms=True, conf=0.25, iou=0.4, imgsz=640)
|
| 121 |
results = outputs[0].cpu().numpy()
|
| 122 |
re_boxes = results.boxes.data.tolist()
|
| 123 |
|