Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions notebooks/train-yolov5-classification-on-custom-data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@
"#Download example image\n",
"import requests\n",
"image_url = \"https://i.imgur.com/OczPfaz.jpg\"\n",
"img_data = requests.get(image_url).content\n",
"response = requests.get(image_url)\n",
"response.raise_for_status()\n",
"with open('bananas.jpg', 'wb') as handler:\n",
" handler.write(img_data)"
" handler.write(response.content)"
],
"metadata": {
"id": "L9objhVHnS-h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,10 @@
"#Download example image\n",
"import requests\n",
"image_url = \"https://i.imgur.com/EbOBS5l.jpg\"\n",
"img_data = requests.get(image_url).content\n",
"response = requests.get(image_url)\n",
"response.raise_for_status()\n",
"with open(f\"{HOME}/yolov5/data/images/zebra.jpg\", \"wb\") as handler:\n",
" handler.write(img_data)"
" handler.write(response.content)"
]
},
{
Expand Down Expand Up @@ -1627,16 +1628,17 @@
"#demo. These images are relevant to the ASL Poly dataset. Skip the rest of this\n",
"#cell if you are providing your own example image directory.\n",
"os.makedirs(example_image_dir, exist_ok=True)\n",
"image_links = [\n",
"image_urls = [\n",
" \"https://i.imgur.com/rFsDnHC.jpg\", \n",
" \"https://i.imgur.com/aEcceXm.jpg\", \n",
" \"https://i.imgur.com/s4N63fx.jpg\",\n",
" ]\n",
"\n",
"for i,link in enumerate(image_links):\n",
" img_data = requests.get(link).content\n",
" with open(os.path.join(example_image_dir,f'example_{i}.jpg'), 'wb') as handler:\n",
" handler.write(img_data)"
"for i, image_url in enumerate(image_urls):\n",
" response = requests.get(image_url)\n",
" response.raise_for_status()\n",
" with open(os.path.join(example_image_dir,f'example_{i}.jpg'), 'wb') as handler:\n",
" handler.write(response.content)"
]
},
{
Expand Down