-
Notifications
You must be signed in to change notification settings - Fork 2
feat(viz): Add visualization module for VLM Run results #79
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
Conversation
| @@ -1,5 +1,8 @@ | |||
| cachetools | |||
| IPython | |||
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.
I wouldn't add IPython as a core dependency unless we need it.
| return img | ||
|
|
||
|
|
||
| def render_image(image: ImageType, width: Optional[int] = None) -> str: |
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.
Let's move this into vlmrun.common.jupyter.format_image_html
| } | ||
|
|
||
|
|
||
| def format_json_html(data: Dict[str, Any], indent: int = 2) -> str: |
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.
Move to vlmrun.common.jupyter.format_json_html
| return f'<pre style="margin: 0; white-space: pre-wrap;">{json_str}</pre>' | ||
|
|
||
|
|
||
| def show_results( |
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.
Move to vlmrun/common/jupyter/
| raise ValueError("image_width must be a positive integer") | ||
|
|
||
|
|
||
| def xywh_to_xyxy(box: XYWHBox) -> BoundingBox: |
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.
Would prefer if we have a BoundingBox class and have classmethods for these to_xyxy, to_xywh etc.
| return (x, y, x + w, y + h) | ||
|
|
||
|
|
||
| def extract_bbox(value: Union[Dict, List]) -> Optional[BoundingBox]: |
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.
Use BoundingBox.from_dict
| return None | ||
|
|
||
|
|
||
| def get_boxes_from_response(response: Union[Dict, Any]) -> List[Dict[str, BoundingBox]]: |
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.
Don't we want the attributes casted into BoundingBox instead?
PR Description
Add comprehensive visualization module for displaying VLM Run results with images:
Example usage: