Skip to content

Conversation

@jkitching
Copy link
Contributor

Description

Sometimes, image files may fail to download due to HTTP errors such as "429 Too Many Requests". As a result of the image file on disk being empty, errors may occur later on in the notebook, which can look somewhat misleading:

cv2.error: OpenCV(4.7.0) /io/opencv/modules/imgcodecs/src/loadsave.cpp:798:
error: (-215:Assertion failed) !buf.empty() in function 'imdecode_'

Add a call to raise_for_status() on the returned response object from the requests library, which at the very least notifies the user that something has gone wrong.

(Alternately, perhaps consider relocating the images from imgur to some other CDN, or even commit them directly to this repository.)

Also, fix some indentation, spacing, and variable naming inconsistencies.

Type of change

Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

Manually tested running the notebooks, ensuring the 429 error is displayed to the user.

Any specific deployment considerations

None.

Docs

No documentation was updated.

Sometimes, image files may fail to download due to HTTP errors such as
"429 Too Many Requests".  As a result of the image file on disk being
empty, errors may occur later on in the notebook, which can look
somewhat misleading:

cv2.error: OpenCV(4.7.0) /io/opencv/modules/imgcodecs/src/loadsave.cpp:798:
  error: (-215:Assertion failed) !buf.empty() in function 'imdecode_'

Add a call to `raise_for_status()` on the returned `response` object
from the `requests` library, which at the very least notifies the user
that something has gone wrong.

(Alternately, perhaps consider relocating the images from imgur to some
other CDN, or even commit them directly to this repository.)

Also, fix some indentation, spacing, and variable naming
inconsistencies.
@CLAassistant
Copy link

CLAassistant commented Aug 11, 2023

CLA assistant check
All committers have signed the CLA.

@SkalskiP
Copy link
Collaborator

Hi, @jkitching 👋🏻! I was away for a few days. Awesome 🔥! Thanks for that contribution. Could you sign the CLA so I could merge it into the master? 🙏🏻

@jkitching
Copy link
Contributor Author

Hi @SkalskiP, thanks for your response! I've signed the CLA.

Is the same CLA also valid for this other pull request?
roboflow/video-inference#4

@capjamesg
Copy link
Contributor

@jkitching The video-inference repository is mostly obsolete now. Piotr made a newer version that uses Roboflow Inference, our open source inference server. I will chat with our team to see if we should archive video-inference.

@capjamesg capjamesg self-requested a review September 18, 2023 07:35
Copy link
Contributor

@capjamesg capjamesg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Regarding use of Imgur, we will keep that in mind as we write new notebooks. We definitely want to use persistent image URLs so our notebook images are available over time.

@capjamesg capjamesg merged commit 5d0a9bc into roboflow:main Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants