Skip to content

Commit 7a48927

Browse files
committed
Simpler bounding box
1 parent a253729 commit 7a48927

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chapter12_object-detection.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@
602602
"source": [
603603
"detector = keras_hub.models.ObjectDetector.from_preset(\n",
604604
" \"retinanet_resnet50_fpn_v2_coco\",\n",
605+
" bounding_box_format=\"rel_xywh\",\n",
605606
")\n",
606607
"predictions = detector.predict(image)"
607608
]
@@ -639,8 +640,7 @@
639640
"ig, ax = plt.subplots(dpi=300)\n",
640641
"draw_image(ax, path)\n",
641642
"for i in range(predictions[\"num_detections\"][0]):\n",
642-
" y1, x1, y2, x2 = predictions[\"boxes\"][0][i]\n",
643-
" box = (x1 / 800, y1 / 800, (x2 - x1) / 800, (y2 - y1) / 800)\n",
643+
" box = predictions[\"boxes\"][0][i]\n",
644644
" label = predictions[\"labels\"][0][i]\n",
645645
" label_name = keras_hub.utils.coco_id_to_name(label)\n",
646646
" draw_box(ax, box, label_name, label_to_color(label))\n",

0 commit comments

Comments
 (0)