-
Notifications
You must be signed in to change notification settings - Fork 1.2k
docs: Clarify required image shape (C × H × W) for vis.image #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDocumentation-only change updating the vis.image README section to explicitly call out that the function expects images in C×H×W format and that common Python image libraries instead return H×W×C, which can cause errors or incorrect rendering. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue, and left some high level feedback:
- There appears to be a missing space after the first sentence in the new text (
image.Most→image. Most). - Consider briefly showing how to convert from
HxWxCtoCxHxW(e.g., with a small code snippet using NumPy or PyTorch) to make the guidance immediately actionable for users.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There appears to be a missing space after the first sentence in the new text (`image.Most` → `image. Most`).
- Consider briefly showing how to convert from `HxWxC` to `CxHxW` (e.g., with a small code snippet using NumPy or PyTorch) to make the guidance immediately actionable for users.
## Individual Comments
### Comment 1
<location> `README.md:322` </location>
<code_context>
#### vis.image
-This function draws an `img`. It takes as input an `CxHxW` tensor `img`
-that contains the image.
+This function draws an `img`. It takes as input an `CxHxW` tensor `img` that contains the image.Most Python image libraries (e.g. OpenCV, PIL, matplotlib) return images in `HxWxC` format. Passing images in that format will raise errors or lead to incorrect rendering.
The following `opts` are supported:
</code_context>
<issue_to_address>
**issue (typo):** Missing space after the period in "image.Most".
Add a space after the period so it reads "image. Most".
```suggestion
This function draws an `img`. It takes as input an `CxHxW` tensor `img` that contains the image. Most Python image libraries (e.g. OpenCV, PIL, matplotlib) return images in `HxWxC` format. Passing images in that format will raise errors or lead to incorrect rendering.
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| #### vis.image | ||
| This function draws an `img`. It takes as input an `CxHxW` tensor `img` | ||
| that contains the image. | ||
| This function draws an `img`. It takes as input an `CxHxW` tensor `img` that contains the image.Most Python image libraries (e.g. OpenCV, PIL, matplotlib) return images in `HxWxC` format. Passing images in that format will raise errors or lead to incorrect rendering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (typo): Missing space after the period in "image.Most".
Add a space after the period so it reads "image. Most".
| This function draws an `img`. It takes as input an `CxHxW` tensor `img` that contains the image.Most Python image libraries (e.g. OpenCV, PIL, matplotlib) return images in `HxWxC` format. Passing images in that format will raise errors or lead to incorrect rendering. | |
| This function draws an `img`. It takes as input an `CxHxW` tensor `img` that contains the image. Most Python image libraries (e.g. OpenCV, PIL, matplotlib) return images in `HxWxC` format. Passing images in that format will raise errors or lead to incorrect rendering. |
Description
This PR adds a small clarification to the
vis.imagedocumentation to explicitly highlight the required image shape (C × H × W).The existing documentation mentions the expected shape, but it is easy for new users to miss, especially since most Python image libraries return images in H × W × C format.
Motivation and Context
While using Visdom as a first-time user, passing images in H × W × C format resulted in a non-obvious runtime error originating from PIL. This change makes the shape requirement explicit at the point of use to help prevent common confusion and reduce avoidable errors for
new users.
How Has This Been Tested?
vis.imageworks correctly when passing images inC × H × W format.
to confirm the documented behavior.
Screenshots (if appropriate):
N/A (documentation-only change)
Types of changes
Checklist:
py/visdom/VERSIONaccording to Semantic VersioningSummary by Sourcery
Documentation: