Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,8 @@ from torchvision.utils import draw_bounding_boxes
|
|
| 11 |
import rfdetr.datasets.transforms as T
|
| 12 |
from torchvision.ops import box_convert
|
| 13 |
|
|
|
|
|
|
|
| 14 |
def _box_yxyx_to_xyxy(boxes: torch.Tensor) -> torch.Tensor:
|
| 15 |
"""Convert bounding boxes from (y1, x1, y2, x2) format to (x1, y1, x2, y2) format.
|
| 16 |
|
|
@@ -115,9 +117,9 @@ def draw_predictions(boxes, labels, scores, img, score_threshold=0.5, font_size=
|
|
| 115 |
colors=colors,
|
| 116 |
width=10,
|
| 117 |
font_size=30,
|
| 118 |
-
font="
|
| 119 |
)
|
| 120 |
-
imgs_list.append(img_bbox.permute(1, 2, 0).numpy())
|
| 121 |
|
| 122 |
return imgs_list
|
| 123 |
|
|
|
|
| 11 |
import rfdetr.datasets.transforms as T
|
| 12 |
from torchvision.ops import box_convert
|
| 13 |
|
| 14 |
+
# Adapted from https://huggingface.co/spaces/rizavelioglu/fashionfail
|
| 15 |
+
|
| 16 |
def _box_yxyx_to_xyxy(boxes: torch.Tensor) -> torch.Tensor:
|
| 17 |
"""Convert bounding boxes from (y1, x1, y2, x2) format to (x1, y1, x2, y2) format.
|
| 18 |
|
|
|
|
| 117 |
colors=colors,
|
| 118 |
width=10,
|
| 119 |
font_size=30,
|
| 120 |
+
font="arial.ttf",
|
| 121 |
)
|
| 122 |
+
imgs_list.append(img_bbox.permute(1, 2, 0).numpy())
|
| 123 |
|
| 124 |
return imgs_list
|
| 125 |
|