sinapsis-data-visualization 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/PKG-INFO +182 -2
- sinapsis_data_visualization-0.1.2/README.md +175 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/pyproject.toml +14 -2
- sinapsis_data_visualization-0.1.2/src/sinapsis_data_visualization/templates/base_annotation_drawer.py +167 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization.egg-info/PKG-INFO +182 -2
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization.egg-info/SOURCES.txt +1 -0
- sinapsis_data_visualization-0.1.0/src/sinapsis_data_visualization/templates/base_annotation_drawer.py +0 -103
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/LICENSE +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/setup.cfg +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/__init__.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/__init__.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/helpers/__init__.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/helpers/annotation_drawer_tools.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/helpers/annotation_drawer_types.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/helpers/color_utils.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/helpers/detection_utils.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/helpers/plot_distributions.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/helpers/scikit_pca_analysis.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/templates/__init__.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/templates/bbox_drawer.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/templates/data_distribution_visualization_template.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/templates/key_points_drawer.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/templates/label_drawer.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/templates/oriented_bbox_drawer.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization/templates/segmentation_mask_drawer.py +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization.egg-info/dependency_links.txt +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization.egg-info/requires.txt +0 -0
- {sinapsis_data_visualization-0.1.0 → sinapsis_data_visualization-0.1.2}/src/sinapsis_data_visualization.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: sinapsis-data-visualization
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Templates to perform visualization of data distributions and image annotations.
|
|
5
5
|
Author-email: SinapsisAI <dev@sinapsis.tech>
|
|
6
6
|
License: GNU AFFERO GENERAL PUBLIC LICENSE
|
|
@@ -665,6 +665,10 @@ License: GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
665
665
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
666
666
|
<https://www.gnu.org/licenses/>.
|
|
667
667
|
|
|
668
|
+
Project-URL: Homepage, https://sinapsis.tech
|
|
669
|
+
Project-URL: Documentation, https://docs.sinapsis.tech/docs
|
|
670
|
+
Project-URL: Tutorials, https://docs.sinapsis.tech/tutorials
|
|
671
|
+
Project-URL: Repository, https://github.com/Sinapsis-AI/sinapsis-data-tools.git
|
|
668
672
|
Requires-Python: >=3.10
|
|
669
673
|
Description-Content-Type: text/markdown
|
|
670
674
|
Requires-Dist: sinapsis>=0.1.1
|
|
@@ -672,3 +676,179 @@ Provides-Extra: visualization-matplotlib
|
|
|
672
676
|
Requires-Dist: matplotlib>=3.9.2; extra == "visualization-matplotlib"
|
|
673
677
|
Provides-Extra: all
|
|
674
678
|
Requires-Dist: sinapsis-data-visualization[visualization-matplotlib]; extra == "all"
|
|
679
|
+
|
|
680
|
+
<h1 align="center">
|
|
681
|
+
<br>
|
|
682
|
+
<a href="https://sinapsis.tech/">
|
|
683
|
+
<img
|
|
684
|
+
src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true"
|
|
685
|
+
alt="" width="300">
|
|
686
|
+
</a>
|
|
687
|
+
|
|
688
|
+
<br>
|
|
689
|
+
Sinapsis Data Visualization
|
|
690
|
+
<br>
|
|
691
|
+
</h1>
|
|
692
|
+
|
|
693
|
+
<h4 align="center"> Package with templates to visualize images and data distribution using different libraries and techniques</h4>
|
|
694
|
+
|
|
695
|
+
<p align="center">
|
|
696
|
+
<a href="#installation">🐍 Installation</a> •
|
|
697
|
+
<a href="#features">🚀 Features</a> •
|
|
698
|
+
<a href="#usage">📚 Usage example</a> •
|
|
699
|
+
<a href="#documentation">📙 Documentation</a> •
|
|
700
|
+
<a href="#license">🔍 License</a>
|
|
701
|
+
</p>
|
|
702
|
+
|
|
703
|
+
<h2 id="installation">🐍 Installation</h2>
|
|
704
|
+
|
|
705
|
+
Install using your package manager of choice. We encourage the use of <code>uv</code>
|
|
706
|
+
|
|
707
|
+
Example with <code>uv</code>:
|
|
708
|
+
|
|
709
|
+
```bash
|
|
710
|
+
uv pip install sinapsis-data-visualization --extra-index-url https://pypi.sinapsis.tech
|
|
711
|
+
```
|
|
712
|
+
or with raw <code>pip</code>:
|
|
713
|
+
```bash
|
|
714
|
+
pip install sinapsis-data-visualization --extra-index-url https://pypi.sinapsis.tech
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
> [!IMPORTANT]
|
|
718
|
+
> Templates in each package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
|
|
719
|
+
>
|
|
720
|
+
|
|
721
|
+
with <code>uv</code>:
|
|
722
|
+
|
|
723
|
+
```bash
|
|
724
|
+
uv pip install sinapsis-data-visualization[all] --extra-index-url https://pypi.sinapsis.tech
|
|
725
|
+
```
|
|
726
|
+
or with raw <code>pip</code>:
|
|
727
|
+
```bash
|
|
728
|
+
pip install sinapsis-data-visualization[all] --extra-index-url https://pypi.sinapsis.tech
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
<h2 id="features">🚀 Features</h2>
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
> [!TIP]
|
|
737
|
+
> Use CLI command ``` sinapsis info --all-template-names``` to show a list with all the available Template names installed with Sinapsis Data Tools.
|
|
738
|
+
|
|
739
|
+
> [!TIP]
|
|
740
|
+
> Use CLI command ```sinapsis info --example-template-config TEMPLATE_NAME``` to produce an example Agent config for the Template specified in ***TEMPLATE_NAME***.
|
|
741
|
+
|
|
742
|
+
For example, for ***ImageSaver*** use ```sinapsis info --example-template-config ImageSaver``` to produce the following example config:
|
|
743
|
+
<details id='packages'><summary><strong><span style="font-size: 1.0em;"> Config</span></strong></summary>
|
|
744
|
+
|
|
745
|
+
```yaml
|
|
746
|
+
agent:
|
|
747
|
+
name: my_test_agent
|
|
748
|
+
description: agent to read images from a local folder and draw annotations if available
|
|
749
|
+
templates:
|
|
750
|
+
- template_name: InputTemplate
|
|
751
|
+
class_name: InputTemplate
|
|
752
|
+
attributes: {}
|
|
753
|
+
- template_name: FolderImageDatasetCV2
|
|
754
|
+
class_name: FolderImageDatasetCV2
|
|
755
|
+
template_input: InputTemplate
|
|
756
|
+
attributes:
|
|
757
|
+
data_dir: '/path/to/sinapsis/cache/dir'
|
|
758
|
+
pattern: '**/*'
|
|
759
|
+
batch_size: 1
|
|
760
|
+
shuffle_data: false
|
|
761
|
+
samples_to_load: -1
|
|
762
|
+
load_on_init: false
|
|
763
|
+
label_path_index: -2
|
|
764
|
+
is_ground_truth: false
|
|
765
|
+
- template_name: BBoxDrawer
|
|
766
|
+
class_name: BBoxDrawer
|
|
767
|
+
template_input: FolderImageDatasetCV2
|
|
768
|
+
attributes:
|
|
769
|
+
overwrite: false
|
|
770
|
+
randomized_color: true
|
|
771
|
+
draw_confidence: true
|
|
772
|
+
draw_extra_labels: true
|
|
773
|
+
text_style:
|
|
774
|
+
font: 0
|
|
775
|
+
font_scale: 0.5
|
|
776
|
+
thickness: 2
|
|
777
|
+
draw_classification_label: false
|
|
778
|
+
classification_label_position: top_right
|
|
779
|
+
text_box_to_border_offset: 0.01
|
|
780
|
+
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
<h2 id="usage">📚 Usage example</h2>
|
|
785
|
+
You can copy and paste the following config and run it using the sinapsis cli, changing the <code>data_dir</code> attribute in the <code>FolderImageDatasetCV2</code> and the <code>root_dir</code> attribute in the <code>ImageSaver</code> template
|
|
786
|
+
|
|
787
|
+
<details id='usage'><summary><strong><span style="font-size: 1.0em;"> Example agent config</span></strong></summary>
|
|
788
|
+
|
|
789
|
+
```yaml
|
|
790
|
+
agent:
|
|
791
|
+
name: my_test_agent
|
|
792
|
+
description: agent to save image locally
|
|
793
|
+
templates:
|
|
794
|
+
- template_name: InputTemplate
|
|
795
|
+
class_name: InputTemplate
|
|
796
|
+
attributes: {}
|
|
797
|
+
- template_name: FolderImageDatasetCV2
|
|
798
|
+
class_name: FolderImageDatasetCV2
|
|
799
|
+
attributes:
|
|
800
|
+
data_dir: /path/to/image
|
|
801
|
+
pattern: '**/*'
|
|
802
|
+
batch_size: 1
|
|
803
|
+
load_on_init: true
|
|
804
|
+
label_path_index: 0
|
|
805
|
+
is_ground_truth: false
|
|
806
|
+
- template_name: BBoxDrawer
|
|
807
|
+
class_name: BBoxDrawer
|
|
808
|
+
template_input: FolderImageDatasetCV2
|
|
809
|
+
attributes:
|
|
810
|
+
overwrite: false
|
|
811
|
+
randomized_color: true
|
|
812
|
+
draw_confidence: true
|
|
813
|
+
draw_extra_labels: true
|
|
814
|
+
text_style:
|
|
815
|
+
font: 0
|
|
816
|
+
font_scale: 0.5
|
|
817
|
+
thickness: 2
|
|
818
|
+
draw_classification_label: false
|
|
819
|
+
classification_label_position: top_right
|
|
820
|
+
text_box_to_border_offset: 0.01
|
|
821
|
+
- template_name: ImageSaver
|
|
822
|
+
class_name: ImageSaver
|
|
823
|
+
template_input: BBoxDrawer
|
|
824
|
+
attributes:
|
|
825
|
+
save_dir: /path/to/save/dir
|
|
826
|
+
extension: jpg
|
|
827
|
+
root_dir: '/path/to/sinapsis/cache'
|
|
828
|
+
save_full_image: true
|
|
829
|
+
save_bbox_crops: false
|
|
830
|
+
save_mask_crops: false
|
|
831
|
+
min_bbox_dim: 5
|
|
832
|
+
```
|
|
833
|
+
</details>
|
|
834
|
+
|
|
835
|
+
To run, simply use:
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
sinapsis run name_of_the_config.yml
|
|
839
|
+
```
|
|
840
|
+
</details>
|
|
841
|
+
<h2 id="documentation">📙 Documentation</h2>
|
|
842
|
+
|
|
843
|
+
Documentation for this and other sinapsis packages is available on the [sinapsis website](https://docs.sinapsis.tech/docs)
|
|
844
|
+
|
|
845
|
+
Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials)
|
|
846
|
+
|
|
847
|
+
<h2 id="license">🔍 License</h2>
|
|
848
|
+
|
|
849
|
+
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file.
|
|
850
|
+
|
|
851
|
+
For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license.
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<br>
|
|
3
|
+
<a href="https://sinapsis.tech/">
|
|
4
|
+
<img
|
|
5
|
+
src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true"
|
|
6
|
+
alt="" width="300">
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
<br>
|
|
10
|
+
Sinapsis Data Visualization
|
|
11
|
+
<br>
|
|
12
|
+
</h1>
|
|
13
|
+
|
|
14
|
+
<h4 align="center"> Package with templates to visualize images and data distribution using different libraries and techniques</h4>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="#installation">🐍 Installation</a> •
|
|
18
|
+
<a href="#features">🚀 Features</a> •
|
|
19
|
+
<a href="#usage">📚 Usage example</a> •
|
|
20
|
+
<a href="#documentation">📙 Documentation</a> •
|
|
21
|
+
<a href="#license">🔍 License</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<h2 id="installation">🐍 Installation</h2>
|
|
25
|
+
|
|
26
|
+
Install using your package manager of choice. We encourage the use of <code>uv</code>
|
|
27
|
+
|
|
28
|
+
Example with <code>uv</code>:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv pip install sinapsis-data-visualization --extra-index-url https://pypi.sinapsis.tech
|
|
32
|
+
```
|
|
33
|
+
or with raw <code>pip</code>:
|
|
34
|
+
```bash
|
|
35
|
+
pip install sinapsis-data-visualization --extra-index-url https://pypi.sinapsis.tech
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> [!IMPORTANT]
|
|
39
|
+
> Templates in each package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
with <code>uv</code>:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uv pip install sinapsis-data-visualization[all] --extra-index-url https://pypi.sinapsis.tech
|
|
46
|
+
```
|
|
47
|
+
or with raw <code>pip</code>:
|
|
48
|
+
```bash
|
|
49
|
+
pip install sinapsis-data-visualization[all] --extra-index-url https://pypi.sinapsis.tech
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
<h2 id="features">🚀 Features</h2>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
> [!TIP]
|
|
58
|
+
> Use CLI command ``` sinapsis info --all-template-names``` to show a list with all the available Template names installed with Sinapsis Data Tools.
|
|
59
|
+
|
|
60
|
+
> [!TIP]
|
|
61
|
+
> Use CLI command ```sinapsis info --example-template-config TEMPLATE_NAME``` to produce an example Agent config for the Template specified in ***TEMPLATE_NAME***.
|
|
62
|
+
|
|
63
|
+
For example, for ***ImageSaver*** use ```sinapsis info --example-template-config ImageSaver``` to produce the following example config:
|
|
64
|
+
<details id='packages'><summary><strong><span style="font-size: 1.0em;"> Config</span></strong></summary>
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
agent:
|
|
68
|
+
name: my_test_agent
|
|
69
|
+
description: agent to read images from a local folder and draw annotations if available
|
|
70
|
+
templates:
|
|
71
|
+
- template_name: InputTemplate
|
|
72
|
+
class_name: InputTemplate
|
|
73
|
+
attributes: {}
|
|
74
|
+
- template_name: FolderImageDatasetCV2
|
|
75
|
+
class_name: FolderImageDatasetCV2
|
|
76
|
+
template_input: InputTemplate
|
|
77
|
+
attributes:
|
|
78
|
+
data_dir: '/path/to/sinapsis/cache/dir'
|
|
79
|
+
pattern: '**/*'
|
|
80
|
+
batch_size: 1
|
|
81
|
+
shuffle_data: false
|
|
82
|
+
samples_to_load: -1
|
|
83
|
+
load_on_init: false
|
|
84
|
+
label_path_index: -2
|
|
85
|
+
is_ground_truth: false
|
|
86
|
+
- template_name: BBoxDrawer
|
|
87
|
+
class_name: BBoxDrawer
|
|
88
|
+
template_input: FolderImageDatasetCV2
|
|
89
|
+
attributes:
|
|
90
|
+
overwrite: false
|
|
91
|
+
randomized_color: true
|
|
92
|
+
draw_confidence: true
|
|
93
|
+
draw_extra_labels: true
|
|
94
|
+
text_style:
|
|
95
|
+
font: 0
|
|
96
|
+
font_scale: 0.5
|
|
97
|
+
thickness: 2
|
|
98
|
+
draw_classification_label: false
|
|
99
|
+
classification_label_position: top_right
|
|
100
|
+
text_box_to_border_offset: 0.01
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
<h2 id="usage">📚 Usage example</h2>
|
|
106
|
+
You can copy and paste the following config and run it using the sinapsis cli, changing the <code>data_dir</code> attribute in the <code>FolderImageDatasetCV2</code> and the <code>root_dir</code> attribute in the <code>ImageSaver</code> template
|
|
107
|
+
|
|
108
|
+
<details id='usage'><summary><strong><span style="font-size: 1.0em;"> Example agent config</span></strong></summary>
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
agent:
|
|
112
|
+
name: my_test_agent
|
|
113
|
+
description: agent to save image locally
|
|
114
|
+
templates:
|
|
115
|
+
- template_name: InputTemplate
|
|
116
|
+
class_name: InputTemplate
|
|
117
|
+
attributes: {}
|
|
118
|
+
- template_name: FolderImageDatasetCV2
|
|
119
|
+
class_name: FolderImageDatasetCV2
|
|
120
|
+
attributes:
|
|
121
|
+
data_dir: /path/to/image
|
|
122
|
+
pattern: '**/*'
|
|
123
|
+
batch_size: 1
|
|
124
|
+
load_on_init: true
|
|
125
|
+
label_path_index: 0
|
|
126
|
+
is_ground_truth: false
|
|
127
|
+
- template_name: BBoxDrawer
|
|
128
|
+
class_name: BBoxDrawer
|
|
129
|
+
template_input: FolderImageDatasetCV2
|
|
130
|
+
attributes:
|
|
131
|
+
overwrite: false
|
|
132
|
+
randomized_color: true
|
|
133
|
+
draw_confidence: true
|
|
134
|
+
draw_extra_labels: true
|
|
135
|
+
text_style:
|
|
136
|
+
font: 0
|
|
137
|
+
font_scale: 0.5
|
|
138
|
+
thickness: 2
|
|
139
|
+
draw_classification_label: false
|
|
140
|
+
classification_label_position: top_right
|
|
141
|
+
text_box_to_border_offset: 0.01
|
|
142
|
+
- template_name: ImageSaver
|
|
143
|
+
class_name: ImageSaver
|
|
144
|
+
template_input: BBoxDrawer
|
|
145
|
+
attributes:
|
|
146
|
+
save_dir: /path/to/save/dir
|
|
147
|
+
extension: jpg
|
|
148
|
+
root_dir: '/path/to/sinapsis/cache'
|
|
149
|
+
save_full_image: true
|
|
150
|
+
save_bbox_crops: false
|
|
151
|
+
save_mask_crops: false
|
|
152
|
+
min_bbox_dim: 5
|
|
153
|
+
```
|
|
154
|
+
</details>
|
|
155
|
+
|
|
156
|
+
To run, simply use:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
sinapsis run name_of_the_config.yml
|
|
160
|
+
```
|
|
161
|
+
</details>
|
|
162
|
+
<h2 id="documentation">📙 Documentation</h2>
|
|
163
|
+
|
|
164
|
+
Documentation for this and other sinapsis packages is available on the [sinapsis website](https://docs.sinapsis.tech/docs)
|
|
165
|
+
|
|
166
|
+
Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials)
|
|
167
|
+
|
|
168
|
+
<h2 id="license">🔍 License</h2>
|
|
169
|
+
|
|
170
|
+
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file.
|
|
171
|
+
|
|
172
|
+
For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license.
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sinapsis-data-visualization"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = "Templates to perform visualization of data distributions and image annotations."
|
|
5
5
|
authors = [{ name = "SinapsisAI", email = "dev@sinapsis.tech" }]
|
|
6
6
|
|
|
@@ -21,4 +21,16 @@ sinapsis-data-visualization = { workspace = true }
|
|
|
21
21
|
requires = ["setuptools"]
|
|
22
22
|
build-backend = "setuptools.build_meta"
|
|
23
23
|
[tool.setuptools]
|
|
24
|
-
license-files = []
|
|
24
|
+
license-files = []
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
[[tool.uv.index]]
|
|
28
|
+
name = "sinapsis"
|
|
29
|
+
url = "https://pypi.sinapsis.tech/"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://sinapsis.tech"
|
|
34
|
+
Documentation = "https://docs.sinapsis.tech/docs"
|
|
35
|
+
Tutorials = "https://docs.sinapsis.tech/tutorials"
|
|
36
|
+
Repository = "https://github.com/Sinapsis-AI/sinapsis-data-tools.git"
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import abc
|
|
3
|
+
import random
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
from sinapsis_core.data_containers.annotations import ImageAnnotations
|
|
8
|
+
from sinapsis_core.data_containers.data_packet import DataContainer, ImagePacket
|
|
9
|
+
from sinapsis_core.template_base import (
|
|
10
|
+
Template,
|
|
11
|
+
TemplateAttributes,
|
|
12
|
+
TemplateAttributeType,
|
|
13
|
+
)
|
|
14
|
+
from sinapsis_data_visualization.helpers.color_utils import (
|
|
15
|
+
RGB_TYPE,
|
|
16
|
+
build_color_map,
|
|
17
|
+
get_color_rgb_tuple,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
random.seed(0)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BaseAnnotationDrawer(Template, abc.ABC):
|
|
24
|
+
"""Base template to handle and draw annotations in images.
|
|
25
|
+
|
|
26
|
+
This class incorporates methods to determine if an ImagePacket
|
|
27
|
+
has annotations and to draw annotations on images.
|
|
28
|
+
|
|
29
|
+
The execute method calls the draw_annotation method for
|
|
30
|
+
the list of ImagePackets
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
COLOR_MAP = build_color_map()
|
|
34
|
+
|
|
35
|
+
class AttributesBaseModel(TemplateAttributes):
|
|
36
|
+
"""
|
|
37
|
+
Attributes for Image Annotation Drawer
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
overwrite (bool): Enable overwriting original image content.
|
|
41
|
+
If False Image drawing is performed on a copy of the original one.
|
|
42
|
+
randomized_color (bool): Flag to use random colors in the annotations.
|
|
43
|
+
Defaults to True
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
overwrite: bool = False
|
|
47
|
+
randomized_color: bool = True
|
|
48
|
+
|
|
49
|
+
def __init__(self, attributes: TemplateAttributeType) -> None:
|
|
50
|
+
"""Initializes the Image Annotation Drawer with the given attributes."""
|
|
51
|
+
super().__init__(attributes)
|
|
52
|
+
self.drawing_strategies: list = []
|
|
53
|
+
self.set_drawing_strategy()
|
|
54
|
+
|
|
55
|
+
def set_drawing_strategy(self) -> None:
|
|
56
|
+
"""Abstract method to determine which annotations to draw
|
|
57
|
+
(e.g., labels, bbox, kpts, etc.)"""
|
|
58
|
+
|
|
59
|
+
@staticmethod
|
|
60
|
+
def image_has_annotations(image: ImagePacket) -> bool:
|
|
61
|
+
"""
|
|
62
|
+
Checks if the image packet contains annotations.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
image (ImagePacket): The image packet to check.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
bool: True if the image has annotations, False otherwise.
|
|
69
|
+
"""
|
|
70
|
+
return image.annotations is not None
|
|
71
|
+
|
|
72
|
+
def get_annotation_color(self, ann: ImageAnnotations) -> RGB_TYPE:
|
|
73
|
+
"""
|
|
74
|
+
Retrieves the color for an annotation.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
ann: The annotation to fetch the color for.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
RGB_TYPE: The color corresponding to the annotation.
|
|
81
|
+
"""
|
|
82
|
+
return get_color_rgb_tuple(
|
|
83
|
+
color_map=self.COLOR_MAP,
|
|
84
|
+
class_id=ann.label,
|
|
85
|
+
randomized=self.attributes.randomized_color,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
def apply_drawing_strategies(self, image_packet: ImagePacket) -> np.ndarray:
|
|
89
|
+
"""
|
|
90
|
+
Applies drawing strategies to the image packet.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
image_packet (ImagePacket): The image packet containing annotations to draw.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
np.ndarray: The image content after applying the drawing strategies.
|
|
97
|
+
"""
|
|
98
|
+
annotated_image = image_packet.content
|
|
99
|
+
for ann in image_packet.annotations:
|
|
100
|
+
ann_color = self.get_annotation_color(ann)
|
|
101
|
+
for strategy in self.drawing_strategies:
|
|
102
|
+
annotated_image = strategy(annotated_image, ann, ann_color)
|
|
103
|
+
return annotated_image
|
|
104
|
+
|
|
105
|
+
def draw_annotation(self, image_packet: ImagePacket) -> np.ndarray:
|
|
106
|
+
"""
|
|
107
|
+
Draws annotations on the provided image packet.
|
|
108
|
+
|
|
109
|
+
This method checks if the image packet contains annotations and, if so, applies
|
|
110
|
+
drawing strategies to annotate the image.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
image_packet (ImagePacket): The image packet containing annotations to draw.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
np.ndarray: The annotated image content as a NumPy array. If the image doesn't
|
|
117
|
+
have annotations, the original image content is returned without modification.
|
|
118
|
+
"""
|
|
119
|
+
image_packet.content = np.ascontiguousarray(image_packet.content)
|
|
120
|
+
|
|
121
|
+
if not self.image_has_annotations(image_packet):
|
|
122
|
+
return image_packet.content
|
|
123
|
+
|
|
124
|
+
annotated_image = self.apply_drawing_strategies(image_packet)
|
|
125
|
+
|
|
126
|
+
return annotated_image
|
|
127
|
+
|
|
128
|
+
def process_images(self, container: DataContainer) -> None:
|
|
129
|
+
"""
|
|
130
|
+
Process and annotate images in the container.
|
|
131
|
+
If self.attributes.overwrite is True, it overwrites the image content;
|
|
132
|
+
otherwise, it adds annotated images to the container.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
container (DataContainer): The data container containing image packets.
|
|
136
|
+
"""
|
|
137
|
+
if self.attributes.overwrite:
|
|
138
|
+
for image_packet in container.images:
|
|
139
|
+
image_packet.content = self.draw_annotation(image_packet)
|
|
140
|
+
else:
|
|
141
|
+
annotated_images: list[ImagePacket] = []
|
|
142
|
+
for image_packet in container.images:
|
|
143
|
+
annotated_image = self.draw_annotation(image_packet)
|
|
144
|
+
|
|
145
|
+
if annotated_image is not image_packet.content:
|
|
146
|
+
annotated_images.append(
|
|
147
|
+
ImagePacket(
|
|
148
|
+
content=annotated_image,
|
|
149
|
+
color_space=image_packet.color_space,
|
|
150
|
+
source=f"a_{Path(image_packet.source).name}",
|
|
151
|
+
)
|
|
152
|
+
)
|
|
153
|
+
container.images.extend(annotated_images)
|
|
154
|
+
|
|
155
|
+
def execute(self, container: DataContainer) -> DataContainer:
|
|
156
|
+
"""
|
|
157
|
+
Executes image drawer for images in the container.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
container (DataContainer): The data container containing image packets.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
DataContainer: The updated data container with images annotated.
|
|
164
|
+
"""
|
|
165
|
+
self.process_images(container)
|
|
166
|
+
|
|
167
|
+
return container
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: sinapsis-data-visualization
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Templates to perform visualization of data distributions and image annotations.
|
|
5
5
|
Author-email: SinapsisAI <dev@sinapsis.tech>
|
|
6
6
|
License: GNU AFFERO GENERAL PUBLIC LICENSE
|
|
@@ -665,6 +665,10 @@ License: GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
665
665
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
666
666
|
<https://www.gnu.org/licenses/>.
|
|
667
667
|
|
|
668
|
+
Project-URL: Homepage, https://sinapsis.tech
|
|
669
|
+
Project-URL: Documentation, https://docs.sinapsis.tech/docs
|
|
670
|
+
Project-URL: Tutorials, https://docs.sinapsis.tech/tutorials
|
|
671
|
+
Project-URL: Repository, https://github.com/Sinapsis-AI/sinapsis-data-tools.git
|
|
668
672
|
Requires-Python: >=3.10
|
|
669
673
|
Description-Content-Type: text/markdown
|
|
670
674
|
Requires-Dist: sinapsis>=0.1.1
|
|
@@ -672,3 +676,179 @@ Provides-Extra: visualization-matplotlib
|
|
|
672
676
|
Requires-Dist: matplotlib>=3.9.2; extra == "visualization-matplotlib"
|
|
673
677
|
Provides-Extra: all
|
|
674
678
|
Requires-Dist: sinapsis-data-visualization[visualization-matplotlib]; extra == "all"
|
|
679
|
+
|
|
680
|
+
<h1 align="center">
|
|
681
|
+
<br>
|
|
682
|
+
<a href="https://sinapsis.tech/">
|
|
683
|
+
<img
|
|
684
|
+
src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true"
|
|
685
|
+
alt="" width="300">
|
|
686
|
+
</a>
|
|
687
|
+
|
|
688
|
+
<br>
|
|
689
|
+
Sinapsis Data Visualization
|
|
690
|
+
<br>
|
|
691
|
+
</h1>
|
|
692
|
+
|
|
693
|
+
<h4 align="center"> Package with templates to visualize images and data distribution using different libraries and techniques</h4>
|
|
694
|
+
|
|
695
|
+
<p align="center">
|
|
696
|
+
<a href="#installation">🐍 Installation</a> •
|
|
697
|
+
<a href="#features">🚀 Features</a> •
|
|
698
|
+
<a href="#usage">📚 Usage example</a> •
|
|
699
|
+
<a href="#documentation">📙 Documentation</a> •
|
|
700
|
+
<a href="#license">🔍 License</a>
|
|
701
|
+
</p>
|
|
702
|
+
|
|
703
|
+
<h2 id="installation">🐍 Installation</h2>
|
|
704
|
+
|
|
705
|
+
Install using your package manager of choice. We encourage the use of <code>uv</code>
|
|
706
|
+
|
|
707
|
+
Example with <code>uv</code>:
|
|
708
|
+
|
|
709
|
+
```bash
|
|
710
|
+
uv pip install sinapsis-data-visualization --extra-index-url https://pypi.sinapsis.tech
|
|
711
|
+
```
|
|
712
|
+
or with raw <code>pip</code>:
|
|
713
|
+
```bash
|
|
714
|
+
pip install sinapsis-data-visualization --extra-index-url https://pypi.sinapsis.tech
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
> [!IMPORTANT]
|
|
718
|
+
> Templates in each package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
|
|
719
|
+
>
|
|
720
|
+
|
|
721
|
+
with <code>uv</code>:
|
|
722
|
+
|
|
723
|
+
```bash
|
|
724
|
+
uv pip install sinapsis-data-visualization[all] --extra-index-url https://pypi.sinapsis.tech
|
|
725
|
+
```
|
|
726
|
+
or with raw <code>pip</code>:
|
|
727
|
+
```bash
|
|
728
|
+
pip install sinapsis-data-visualization[all] --extra-index-url https://pypi.sinapsis.tech
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
<h2 id="features">🚀 Features</h2>
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
> [!TIP]
|
|
737
|
+
> Use CLI command ``` sinapsis info --all-template-names``` to show a list with all the available Template names installed with Sinapsis Data Tools.
|
|
738
|
+
|
|
739
|
+
> [!TIP]
|
|
740
|
+
> Use CLI command ```sinapsis info --example-template-config TEMPLATE_NAME``` to produce an example Agent config for the Template specified in ***TEMPLATE_NAME***.
|
|
741
|
+
|
|
742
|
+
For example, for ***ImageSaver*** use ```sinapsis info --example-template-config ImageSaver``` to produce the following example config:
|
|
743
|
+
<details id='packages'><summary><strong><span style="font-size: 1.0em;"> Config</span></strong></summary>
|
|
744
|
+
|
|
745
|
+
```yaml
|
|
746
|
+
agent:
|
|
747
|
+
name: my_test_agent
|
|
748
|
+
description: agent to read images from a local folder and draw annotations if available
|
|
749
|
+
templates:
|
|
750
|
+
- template_name: InputTemplate
|
|
751
|
+
class_name: InputTemplate
|
|
752
|
+
attributes: {}
|
|
753
|
+
- template_name: FolderImageDatasetCV2
|
|
754
|
+
class_name: FolderImageDatasetCV2
|
|
755
|
+
template_input: InputTemplate
|
|
756
|
+
attributes:
|
|
757
|
+
data_dir: '/path/to/sinapsis/cache/dir'
|
|
758
|
+
pattern: '**/*'
|
|
759
|
+
batch_size: 1
|
|
760
|
+
shuffle_data: false
|
|
761
|
+
samples_to_load: -1
|
|
762
|
+
load_on_init: false
|
|
763
|
+
label_path_index: -2
|
|
764
|
+
is_ground_truth: false
|
|
765
|
+
- template_name: BBoxDrawer
|
|
766
|
+
class_name: BBoxDrawer
|
|
767
|
+
template_input: FolderImageDatasetCV2
|
|
768
|
+
attributes:
|
|
769
|
+
overwrite: false
|
|
770
|
+
randomized_color: true
|
|
771
|
+
draw_confidence: true
|
|
772
|
+
draw_extra_labels: true
|
|
773
|
+
text_style:
|
|
774
|
+
font: 0
|
|
775
|
+
font_scale: 0.5
|
|
776
|
+
thickness: 2
|
|
777
|
+
draw_classification_label: false
|
|
778
|
+
classification_label_position: top_right
|
|
779
|
+
text_box_to_border_offset: 0.01
|
|
780
|
+
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
<h2 id="usage">📚 Usage example</h2>
|
|
785
|
+
You can copy and paste the following config and run it using the sinapsis cli, changing the <code>data_dir</code> attribute in the <code>FolderImageDatasetCV2</code> and the <code>root_dir</code> attribute in the <code>ImageSaver</code> template
|
|
786
|
+
|
|
787
|
+
<details id='usage'><summary><strong><span style="font-size: 1.0em;"> Example agent config</span></strong></summary>
|
|
788
|
+
|
|
789
|
+
```yaml
|
|
790
|
+
agent:
|
|
791
|
+
name: my_test_agent
|
|
792
|
+
description: agent to save image locally
|
|
793
|
+
templates:
|
|
794
|
+
- template_name: InputTemplate
|
|
795
|
+
class_name: InputTemplate
|
|
796
|
+
attributes: {}
|
|
797
|
+
- template_name: FolderImageDatasetCV2
|
|
798
|
+
class_name: FolderImageDatasetCV2
|
|
799
|
+
attributes:
|
|
800
|
+
data_dir: /path/to/image
|
|
801
|
+
pattern: '**/*'
|
|
802
|
+
batch_size: 1
|
|
803
|
+
load_on_init: true
|
|
804
|
+
label_path_index: 0
|
|
805
|
+
is_ground_truth: false
|
|
806
|
+
- template_name: BBoxDrawer
|
|
807
|
+
class_name: BBoxDrawer
|
|
808
|
+
template_input: FolderImageDatasetCV2
|
|
809
|
+
attributes:
|
|
810
|
+
overwrite: false
|
|
811
|
+
randomized_color: true
|
|
812
|
+
draw_confidence: true
|
|
813
|
+
draw_extra_labels: true
|
|
814
|
+
text_style:
|
|
815
|
+
font: 0
|
|
816
|
+
font_scale: 0.5
|
|
817
|
+
thickness: 2
|
|
818
|
+
draw_classification_label: false
|
|
819
|
+
classification_label_position: top_right
|
|
820
|
+
text_box_to_border_offset: 0.01
|
|
821
|
+
- template_name: ImageSaver
|
|
822
|
+
class_name: ImageSaver
|
|
823
|
+
template_input: BBoxDrawer
|
|
824
|
+
attributes:
|
|
825
|
+
save_dir: /path/to/save/dir
|
|
826
|
+
extension: jpg
|
|
827
|
+
root_dir: '/path/to/sinapsis/cache'
|
|
828
|
+
save_full_image: true
|
|
829
|
+
save_bbox_crops: false
|
|
830
|
+
save_mask_crops: false
|
|
831
|
+
min_bbox_dim: 5
|
|
832
|
+
```
|
|
833
|
+
</details>
|
|
834
|
+
|
|
835
|
+
To run, simply use:
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
sinapsis run name_of_the_config.yml
|
|
839
|
+
```
|
|
840
|
+
</details>
|
|
841
|
+
<h2 id="documentation">📙 Documentation</h2>
|
|
842
|
+
|
|
843
|
+
Documentation for this and other sinapsis packages is available on the [sinapsis website](https://docs.sinapsis.tech/docs)
|
|
844
|
+
|
|
845
|
+
Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials)
|
|
846
|
+
|
|
847
|
+
<h2 id="license">🔍 License</h2>
|
|
848
|
+
|
|
849
|
+
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file.
|
|
850
|
+
|
|
851
|
+
For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license.
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
import abc
|
|
3
|
-
import random
|
|
4
|
-
|
|
5
|
-
import numpy as np
|
|
6
|
-
from sinapsis_core.data_containers.data_packet import DataContainer, ImagePacket
|
|
7
|
-
from sinapsis_core.template_base import (
|
|
8
|
-
Template,
|
|
9
|
-
TemplateAttributes,
|
|
10
|
-
TemplateAttributeType,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
from sinapsis_data_visualization.helpers.color_utils import (
|
|
14
|
-
RGB_TYPE,
|
|
15
|
-
build_color_map,
|
|
16
|
-
get_color_rgb_tuple,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
random.seed(0)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class BaseAnnotationDrawer(Template, abc.ABC):
|
|
23
|
-
"""Base template to handle and draw annotations in images.
|
|
24
|
-
|
|
25
|
-
This class incorporates methods to determine if an ImagePacket
|
|
26
|
-
has annotations and to draw annotations on images.
|
|
27
|
-
|
|
28
|
-
The execute method calls the draw_annotation method for
|
|
29
|
-
the list of ImagePackets
|
|
30
|
-
"""
|
|
31
|
-
|
|
32
|
-
COLOR_MAP = build_color_map()
|
|
33
|
-
|
|
34
|
-
class AttributesBaseModel(TemplateAttributes):
|
|
35
|
-
"""
|
|
36
|
-
Attributes for Image Annotation Drawer
|
|
37
|
-
|
|
38
|
-
Args:
|
|
39
|
-
overwrite (bool): Enable overwriting original image content.
|
|
40
|
-
If False Image drawing is performed on a copy of the original one.
|
|
41
|
-
randomized_color (bool): Flag to use random colors in the annotations.
|
|
42
|
-
Defaults to True
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
overwrite: bool = False
|
|
46
|
-
randomized_color: bool = True
|
|
47
|
-
|
|
48
|
-
def __init__(self, attributes: TemplateAttributeType) -> None:
|
|
49
|
-
"""Initializes the Image Annotation Drawer with the given attributes."""
|
|
50
|
-
super().__init__(attributes)
|
|
51
|
-
self.drawing_strategies: list = []
|
|
52
|
-
self.set_drawing_strategy()
|
|
53
|
-
|
|
54
|
-
def set_drawing_strategy(self) -> None:
|
|
55
|
-
"""Abstract method to determine which annotations to draw
|
|
56
|
-
(e.g., labels, bbox, kpts, etc.)"""
|
|
57
|
-
|
|
58
|
-
@staticmethod
|
|
59
|
-
def image_has_annotations(image: ImagePacket) -> bool:
|
|
60
|
-
"""
|
|
61
|
-
Checks if the image packet contains annotations.
|
|
62
|
-
|
|
63
|
-
Args:
|
|
64
|
-
image (ImagePacket): The image packet to check.
|
|
65
|
-
|
|
66
|
-
Returns:
|
|
67
|
-
bool: True if the image has annotations, False otherwise.
|
|
68
|
-
"""
|
|
69
|
-
return image.annotations is not None
|
|
70
|
-
|
|
71
|
-
def draw_annotation(self, image_packet: ImagePacket) -> None:
|
|
72
|
-
"""
|
|
73
|
-
Abstract method for drawing annotations on an image packet.
|
|
74
|
-
Args:
|
|
75
|
-
image_packet (ImagePacket): The image packet containing annotations to draw.
|
|
76
|
-
"""
|
|
77
|
-
image_packet.content = np.ascontiguousarray(image_packet.content)
|
|
78
|
-
|
|
79
|
-
if self.image_has_annotations(image_packet):
|
|
80
|
-
for ann in image_packet.annotations:
|
|
81
|
-
ann_color: RGB_TYPE = get_color_rgb_tuple(
|
|
82
|
-
color_map=self.COLOR_MAP,
|
|
83
|
-
class_id=ann.label,
|
|
84
|
-
randomized=self.attributes.randomized_color,
|
|
85
|
-
)
|
|
86
|
-
for strategy in self.drawing_strategies:
|
|
87
|
-
image_packet.content = strategy(image_packet.content, ann, ann_color)
|
|
88
|
-
|
|
89
|
-
def execute(self, container: DataContainer) -> DataContainer:
|
|
90
|
-
"""
|
|
91
|
-
Executes image drawer for images in the container.
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
container (DataContainer): The data container containing image packets.
|
|
95
|
-
|
|
96
|
-
Returns:
|
|
97
|
-
DataContainer: The updated data container with images annotated.
|
|
98
|
-
"""
|
|
99
|
-
|
|
100
|
-
for image_packet in container.images:
|
|
101
|
-
self.draw_annotation(image_packet)
|
|
102
|
-
|
|
103
|
-
return container
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|