-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Datumaro visualizer's import errors after introducing lazy import (…
…#1220) - Ticket no. 127143 ### How to test This Python code raises `ImportError` before this patch. <details> <summary>code</summary> ```python import numpy as np import datumaro as dm ### Create example dataset ### def create_example_dataset() -> dm.Dataset: blank_img = dm.Image.from_numpy(np.zeros([10, 10, 3], dtype=np.uint8)) categories = ["label_1", "label_2", "label_3"] points_of_1x1_box = np.array([0, 0, 0, 1, 1, 1, 1, 0]) item_not_to_drop = dm.DatasetItem( id="item_not_to_drop", media=blank_img, annotations=[ dm.Polygon( points=label + points_of_1x1_box, label=label, ) for label in range(len(categories)) ], ) item_drop_by_big_polygon = dm.DatasetItem( id="item_drop_by_big_polygon", media=blank_img, annotations=[ dm.Polygon( points=8 * points_of_1x1_box, # 8x8 box label=0, ) ], ) item_drop_by_polygon_union = dm.DatasetItem( id="item_drop_by_polygon_union", media=blank_img, annotations=[ dm.Polygon( points=offset + 4 * points_of_1x1_box, # 10 5x5 boxes placed in diagnoal label=1, ) for offset in range(10) ], ) return dm.Dataset.from_iterable( iterable=[ item_not_to_drop, item_drop_by_big_polygon, item_drop_by_polygon_union, ], categories=categories, ) dataset = create_example_dataset() vis = dm.Visualizer(dataset) fig = vis.vis_gallery([item for item in dataset]) fig.show() ``` </details> ![image](https://github.com/openvinotoolkit/datumaro/assets/26541465/8e04c9d2-d195-47ea-9e6c-79f5617a745c) After this patch, there is no more these errors. Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
- Loading branch information
Showing
5 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters