Created using Colaboratory
This commit is contained in:
1 parent
1f5a28711d
commit
d5f543a1df
1 file changed
+7
-7
Vendored
+7
-7
@@ -1023,19 +1023,19 @@
|
|||||||
"id": "GMusP4OAxFu6"
|
"id": "GMusP4OAxFu6"
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"# PyTorch Hub\n",
|
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Model\n",
|
"# PyTorch Hub Model\n",
|
||||||
"model = torch.hub.load('ultralytics/yolov5', 'yolov5s')\n",
|
"model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5n - yolov5x6, custom\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Images\n",
|
"# Images\n",
|
||||||
"dir = 'https://ultralytics.com/images/'\n",
|
"img = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL, OpenCV, numpy, list\n",
|
||||||
"imgs = [dir + f for f in ('zidane.jpg', 'bus.jpg')] # batch of images\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"# Inference\n",
|
"# Inference\n",
|
||||||
"results = model(imgs)\n",
|
"results = model(img)\n",
|
||||||
"results.print() # or .show(), .save()"
|
"\n",
|
||||||
|
"# Results\n",
|
||||||
|
"results.print() # or .show(), .save(), .crop(), .pandas(), etc."
|
||||||
],
|
],
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"outputs": []
|
"outputs": []
|
||||||
|
|||||||
Reference in new issue
Block a user