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"
|
||||
},
|
||||
"source": [
|
||||
"# PyTorch Hub\n",
|
||||
"import torch\n",
|
||||
"\n",
|
||||
"# Model\n",
|
||||
"model = torch.hub.load('ultralytics/yolov5', 'yolov5s')\n",
|
||||
"# PyTorch Hub Model\n",
|
||||
"model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5n - yolov5x6, custom\n",
|
||||
"\n",
|
||||
"# Images\n",
|
||||
"dir = 'https://ultralytics.com/images/'\n",
|
||||
"imgs = [dir + f for f in ('zidane.jpg', 'bus.jpg')] # batch of images\n",
|
||||
"img = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL, OpenCV, numpy, list\n",
|
||||
"\n",
|
||||
"# Inference\n",
|
||||
"results = model(imgs)\n",
|
||||
"results.print() # or .show(), .save()"
|
||||
"results = model(img)\n",
|
||||
"\n",
|
||||
"# Results\n",
|
||||
"results.print() # or .show(), .save(), .crop(), .pandas(), etc."
|
||||
],
|
||||
"execution_count": null,
|
||||
"outputs": []
|
||||
|
||||
Reference in new issue
Block a user