jaclearn.visualize package¶
Submodules¶
jaclearn.visualize.box module¶
jaclearn.visualize.html_table module¶
-
class
jaclearn.visualize.html_table.HTMLTableColumnDesc[source]¶ Bases:
jaclearn.visualize.html_table._HTMLTableColumnDesc
-
class
jaclearn.visualize.html_table.HTMLTableVisualizer(visdir, title)[source]¶ Bases:
objectA helper class to generate HTML tables.
Example
>>> vis = HTMLTableVisualizer('<some_dir>', 'Visualization') >>> with vis.html(): >>> with vis.table('Table Name', [ >>> HTMLTableColumnDesc('column1', 'Image', 'image', {'width': '120px'}), >>> HTMLTableColumnDesc('column2', 'Result', 'figure' {}), >>> HTMLTableColumnDesc('column3', 'Supervision', 'text' {}), >>> HTMLTableColumnDesc('column4', 'Prediction', 'code' {'font-size': '12px'}) >>> ]): >>> vis.row(...)
-
FRAMES_JS= '\n<script\n src="https://code.jquery.com/jquery-3.6.0.slim.min.js"\n integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI="\n crossorigin="anonymous"\n></script>\n<script>\nfunction frameMove(elem, offset) {\n elem = $(elem);\n window.elem = elem;\n data = JSON.parse(elem.parent().find(".data").html());\n index = parseInt(elem.parent().find(".index").val());\n\n nextIndex = index + offset;\n if (nextIndex < 0) nextIndex = 0;\n if (nextIndex >= data.length) nextIndex = data.length - 1;\n\n elem.parent().find(".index").val(nextIndex);\n if ("image" in data[nextIndex]) {\n elem.parent().find(".image").attr("src", data[nextIndex]["image"][0]).attr("alt", data[nextIndex]["image"][1]);\n } else {\n elem.parent().find(".text").html(data[nextIndex]["text"]);\n }\n\n if ("info" in data[nextIndex]) {\n elem.parent().find(".info").html("Frame #" + nextIndex.toString() + " :: " + data[nextIndex]["info"]);\n } else {\n elem.parent().find(".info").html("Frame #" + nextIndex.toString());\n }\n}\n</script>\n '¶
-
jaclearn.visualize.imgrid module¶
-
jaclearn.visualize.imgrid.image_grid(all_images, grid_desc)[source]¶ Create a image grid given the description. The description is a list of axis desc, of format: %d[h|v]. If the first number n is a positive number, every n images will be concatenated horizontally or vertically. We allow exactly one axis desc to be only [h|v], meaning the number of images of that axis will be automatically inferred.
Parameters: - all_images – A list of images. Should be np.ndarray of shape (h, w, c).
- grid_desc – The grid description.
Returns: A single big image created.
jaclearn.visualize.imshow module¶
-
jaclearn.visualize.imshow.batch_show(batch, nr_show=16, grid_desc=('4v', '4h'), resize=(600, 800), title='batch_show')[source]¶ Show a batch of images.
Parameters: - batch – The batched data: can be either a ndarray of shape (batch_size, h, w, c) or a list of images.
- nr_show – Number of images to be displayed. Default set to be 16.
- grid_desc – Grid description. See tartist.image.image_grid for details.
- resize – Resize factor, a tuple (min_dim, max_dim).
- title – The title of the shown window.