Skip to content

Commit

Permalink
Fix yolov11 object detection inference visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
SolomonLake committed Oct 4, 2024
1 parent 44687ba commit cb132e4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions notebooks/train-yolo11-object-detection-on-custom-dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -930,18 +930,19 @@
"import IPython\n",
"import inference\n",
"\n",
"model = inference.get_model(dataset.url + \"/\" + dataset.version, userdata.get('ROBOFLOW_API_KEY'))\n",
"model_id = project.id.split(\"/\")[1] + \"/\" + dataset.version\n",
"model = inference.get_model(model_id, userdata.get('ROBOFLOW_API_KEY'))\n",
"\n",
"# choose random test set image\n",
"# Choose random test set image\n",
"test_set_loc = dataset.location + \"/test/images/\"\n",
"random_test_image = random.choice(os.listdir(test_set_loc))\n",
"print(\"running inference on \" + random_test_image)\n",
"\n",
"pred = model.predict(test_set_loc + random_test_image, confidence=40, overlap=30).json()\n",
"detections = sv.Detections.from_inference(pred)\n",
"\n",
"image = cv2.imread(test_set_loc + random_test_image)\n",
"\n",
"results = model.infer(image, confidence=0.4, overlap=30)[0]\n",
"detections = sv.Detections.from_inference(results)\n",
"\n",
"box_annotator = sv.BoxAnnotator()\n",
"label_annotator = sv.LabelAnnotator()\n",
"\n",
Expand Down

0 comments on commit cb132e4

Please sign in to comment.