imagebaker 0.0.50__py3-none-any.whl → 0.0.53__py3-none-any.whl

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.
@@ -39,6 +39,8 @@ class BakerWorker(QObject):
39
39
  self.layers = layers
40
40
  self.filename = filename
41
41
 
42
+ # logger.info(f"Received States: {self.states}")
43
+
42
44
  def process(self):
43
45
  results = []
44
46
  try:
@@ -128,6 +130,9 @@ class BakerWorker(QObject):
128
130
  painter.restore()
129
131
 
130
132
  # Draw the drawing states
133
+ logger.debug(
134
+ f"Drawing states for layer {layer.layer_name}: {state.drawing_states}"
135
+ )
131
136
  if state.drawing_states:
132
137
  painter.save()
133
138
  try:
@@ -147,6 +152,10 @@ class BakerWorker(QObject):
147
152
  painter.drawPoint(
148
153
  drawing_state.position - top_left
149
154
  )
155
+ except Exception as e:
156
+ logger.error(
157
+ f"Error drawing state for layer {layer.layer_name}: {e}"
158
+ )
150
159
  finally:
151
160
  painter.restore()
152
161
 
@@ -201,6 +210,7 @@ class BakerWorker(QObject):
201
210
  new_annotation = self._generate_annotation(
202
211
  ann, alpha_channel
203
212
  )
213
+ new_annotation.caption = layer.caption
204
214
  new_annotations.append(new_annotation)
205
215
  finally:
206
216
  painter.end()
@@ -224,6 +234,8 @@ class BakerWorker(QObject):
224
234
  self.finished.emit(results)
225
235
 
226
236
  except Exception as e:
237
+ import traceback
238
+
227
239
  logger.error(f"Error in BakerWorker: {e}")
228
240
  self.error.emit(str(e))
229
241
  traceback.print_exc()
@@ -242,15 +254,22 @@ class BakerWorker(QObject):
242
254
  annotation_id=ann.annotation_id,
243
255
  is_complete=True,
244
256
  visible=True,
257
+ caption=ann.caption,
258
+ is_model_generated=ann.is_model_generated,
245
259
  )
246
260
 
247
261
  if ann.points:
248
262
  new_annotation.points = ann.points
249
263
  elif ann.rectangle:
250
264
  xywhs = mask_to_rectangles(alpha_channel, merge_rectangles=True)
251
- new_annotation.rectangle = QRectF(
252
- xywhs[0][0], xywhs[0][1], xywhs[0][2], xywhs[0][3]
253
- )
265
+ if len(xywhs) == 0:
266
+ logger.info("No rectangles found")
267
+ # return None
268
+ else:
269
+ logger.info(f"Found {len(xywhs)} rectangles")
270
+ new_annotation.rectangle = QRectF(
271
+ xywhs[0][0], xywhs[0][1], xywhs[0][2], xywhs[0][3]
272
+ )
254
273
  elif ann.polygon:
255
274
  polygon = mask_to_polygons(alpha_channel, merge_polygons=True)
256
275
  poly = QPolygonF([QPointF(p[0], p[1]) for p in polygon[0]])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imagebaker
3
- Version: 0.0.50
3
+ Version: 0.0.53
4
4
  Summary: A package for baking images.
5
5
  Home-page: https://github.com/q-viper/Image-Baker
6
6
  Author: Ramkrishna Acharya
@@ -38,7 +38,7 @@ Requires-Dist: mkdocs-awesome-pages-plugin; extra == "docs"
38
38
  [![PyPI version](https://img.shields.io/pypi/v/imagebaker.svg)](https://pypi.org/imagebaker/)
39
39
 
40
40
  <p align="center">
41
- <img src="assets/demo.gif" alt="Centered Demo" />
41
+ <img src="https://github.com/q-viper/image-baker/blob/main/assets/demo.gif?raw=true" alt="Centered Demo" />
42
42
  </p>
43
43
 
44
44
 
@@ -76,27 +76,28 @@ Run the following command to launch the GUI:
76
76
 
77
77
  `imagebaker`
78
78
 
79
- By default, the above command will not run any models on the backend. So please take a look into the example of model definition at [examples/loaded_models.py](examples/loaded_models.py). Then we need to pass it as:
79
+ By default, the above command will not run any models on the backend. So please take a look into the example of model definition at [examples/loaded_models.py](https://github.com/q-viper/image-baker/blob/main/examples/loaded_models.py). Then we need to pass it as:
80
80
 
81
81
  `imagebaker --models-file examples/loaded_models.py`
82
82
 
83
83
  For more options, please do: `imagebaker --help` It should give the following options.
84
84
 
85
- ![](assets/demo/options.png)
85
+ ![](https://github.com/q-viper/image-baker/blob/main/assets/demo/options.png?raw=true)
86
86
 
87
87
 
88
- * **`--configs-file`** allows us to define custom configs. The custom configs have to inherit LayerConfig and CanvasConfig defined at [imagebaker/core/configs/configs.py](imagebaker/core/configs/configs.py). An example is available at [examples](examples/).
88
+ * **`--configs-file`** allows us to define custom configs. The custom configs have to inherit LayerConfig and CanvasConfig defined at [imagebaker/core/configs/configs.py](https://github.com/q-viper/image-baker/blob/main/imagebaker/core/configs/configs.py). An example is available at [examples](https://github.com/q-viper/image-baker/blob/main/examples/).
89
89
 
90
90
  After cloning and going to the project directory, the following code should work.
91
91
  `imagebaker --models-file examples/loaded_models.py --configs-file examples/example_config.py`
92
92
 
93
93
  ## Features
94
94
  - **Annotating Images**: Load a folder of images and annotate them using bounding boxes or polygons.
95
- - **Model Testing**: Define models for detection, segmentation, and prompts (e.g., points or rectangles) by following the base model structure in [imagebaker/models/base_model.py](imagebaker/models/base_model.py). See [examples/loaded_models.py](examples/loaded_models.py) for a working example.
95
+ - **Model Testing**: Define models for detection, segmentation, and prompts (e.g., points or rectangles) by following the base model structure in [imagebaker/models/base_model.py](https://github.com/q-viper/image-baker/blob/main/imagebaker/models/base_model.py). See [examples/loaded_models.py](https://github.com/q-viper/image-baker/blob/main/examples/loaded_models.py) for a working example.
96
96
  - **Layerifying**: Crop images based on annotations to create reusable layers. Each cropped image represents a single layer.
97
97
  - **Baking States**: Arrange layers to create image variations by dragging, rotating, adjusting opacity, and more. Save the state using the Save State button or Ctrl + S.
98
98
  - **Playing States**: Replay saved states, export them locally, or use them for further predictions.
99
99
  - **Exporting States**: Export the final annotated JSON and the baked multilayer image.
100
+ - **Drawing On Layers**: First select a layer then draw upon it. Only selected layer will be drawn. And if no layers are selected, then the drawing will not be exported.
100
101
 
101
102
  ### Shortcuts
102
103
  * **Ctrl + C**: Copy selected annotation/layer.
@@ -105,34 +106,44 @@ After cloning and going to the project directory, the following code should work
105
106
  * **Left Click**: Select an annotation/layer on mouse position.
106
107
  * **Left Click + Drag**: Drag a selected annotation/layer.
107
108
  * **Double Left Click**: When using polygon annotation, completes the polygon.
108
- * **Right Click**: Deselect an annotation/layer. While annotating the polygon, undo the last point.
109
+ * **Right Click**: Unselect an annotation/layer. While annotating the polygon, undo the last point.
109
110
  * **Ctrl + Mouse Wheel**: Zoom In/Out on the mouse position, i.e., resize the viewport.
110
111
  * **Ctrl + Drag**: If done on the background, the viewport is panned.
111
112
  * **Ctrl + S**: Save State on Baker Tab.
112
113
  * **Ctrl + D**: Draw Mode on Baker Tab. Drawing can happen on a selected or main layer.
113
114
  * **Ctrl + E**: Erase Mode on Baker Tab.
115
+ * **Ctrl + H**: Opens a help window.
114
116
  * **Wheel**: Change the size of the drawing pointer.
117
+ * **Q**: Point mode on annotation.
118
+ * **W**: Polygon mode on annotation. Moves selected layer one step up in layer lists in baker.
119
+ * **S**: Moves selected layer one step down in layer list in baker.
120
+ * **E**: Rectangle mode on annotation.
121
+ * **H**: Hides/un-hides selected annotation/layer.
122
+ * **L**: Creates layer from an annotation. If any annotation selected, creates only its, else creates layers from all visible annotations.
123
+ * **C**: If any annotation is selected, a input box for Caption is created. It can be edited on baker tab as well and is state aware.
124
+ * **Numerics**: Selecting number 1, 2, till 9 selects label. If not available, asks for a new label.
125
+ * **Escape**: Closes the application.
115
126
 
116
127
  ## Demo
117
128
  ### Annotation Page
118
129
  This is where the loading of the image folder and annotation, connection with the model running in the backend, and layerifying happen.
119
130
 
120
- ![](assets/demo/annotation_page.png)
131
+ ![](https://github.com/q-viper/image-baker/blob/main/assets/demo/annotation_page.png?raw=True)
121
132
 
122
133
  ### Baker Page
123
134
  This is where the layer baking happens. And the extraction of the layers as well.
124
135
 
125
- ![](assets/demo/baker_page.png)
136
+ ![](https://github.com/q-viper/image-baker/blob/main/assets/demo/baker_page.png?raw=True)
126
137
 
127
138
  An example of drawing:
128
139
 
129
- ![](assets/demo/drawing.png)
140
+ ![](https://github.com/q-viper/image-baker/blob/main/assets/demo/drawing.png?raw=True)
130
141
 
131
142
  ### Annotated
132
143
 
133
144
  The JSON and the baked image will be exported to the local folder, and in debug mode, the annotations and the mask for each layer will be exported too.
134
145
 
135
- ![](assets/demo/annotated_veg_smiley.png)
146
+ ![](https://github.com/q-viper/image-baker/blob/main/assets/demo/annotated_veg_smiley.png?raw=True)
136
147
 
137
148
  ### Demo Video
138
149
 
@@ -151,3 +162,5 @@ Click on the image above to play the video on YouTube.
151
162
  Contributions are welcome!
152
163
 
153
164
  Do you find this project to be useful and are you looking for some features that are not implemented yet? Feel free to open issues or submit pull requests to improve the project.
165
+
166
+ For more please visit [CONTRIBUTING](CONTRIBUTING).
@@ -1,43 +1,43 @@
1
1
  imagebaker/__init__.py,sha256=zrrxwyzuqVNeIu3rVPrOGYf6SCd5kWsoGcdqqUfsYX4,258
2
2
  imagebaker/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  imagebaker/core/configs/__init__.py,sha256=iyR_GOVMFw3XJSm7293YfyTnaLZa7pLQMfn5tGxVofI,31
4
- imagebaker/core/configs/configs.py,sha256=-qy7vmYaaUk3bh49pwsBig8de_3Y2JWjTDeyWcGQods,5130
4
+ imagebaker/core/configs/configs.py,sha256=hm0CHfMVTD9353wB61Df9bVUb898zQVIFjdoXELdJcc,5694
5
5
  imagebaker/core/defs/__init__.py,sha256=NqV7gYIlRkaS7nx_UTNPSNZbdPrx4w-VurKOKyRLbKY,28
6
- imagebaker/core/defs/defs.py,sha256=-ZItfJdWaK9yFSuFn2LmQ4ncqukAZ_hvYFgE44HUdIo,8394
6
+ imagebaker/core/defs/defs.py,sha256=67L65v8zTKwcrgEgJUVXn3n4xhVuylO23GLvJ-qD1ZU,8710
7
7
  imagebaker/core/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  imagebaker/core/plugins/base_plugin.py,sha256=ROa1HTwV5LgGL-40CHKk_5MZYI5QAT1MzpYO7Fx-9P0,1084
9
9
  imagebaker/core/plugins/cosine_plugin.py,sha256=IXBfvaoxrvf-hytg_dT1zFmOfDbcWXBZ7NvIFPJ2tWQ,1251
10
10
  imagebaker/layers/__init__.py,sha256=q1kUDHhUXEGBOdu6CHDfqCnE2mraLHRqh0DFHYTbnRY,158
11
- imagebaker/layers/annotable_layer.py,sha256=ejBp6nooLtHs8c_G6lOsTJmSwBT404F_dmPsSkjvdEQ,37167
12
- imagebaker/layers/base_layer.py,sha256=1K7Nt6OPITrILj-p4I6Jf0eaesCpdeecOXGj_8oAQb8,30650
13
- imagebaker/layers/canvas_layer.py,sha256=7eDo0UHXRRZ5BX3BciPX88JsumzmwVemtS6cBjU9qwM,42115
11
+ imagebaker/layers/annotable_layer.py,sha256=v8sE73ewESh6sMzFZGrcYTWI-FY-J5-noiIr4YN_rXc,40696
12
+ imagebaker/layers/base_layer.py,sha256=Tbu1D6M2jzK_pIns3ghbHa3NK-htV-klxGo13lR5hNk,30841
13
+ imagebaker/layers/canvas_layer.py,sha256=9nwRzEo1Bp5KrtVYPFKXUVMCqkSW2qflgKBpI0V9FzI,43132
14
14
  imagebaker/list_views/__init__.py,sha256=Aa9slE6do8eYgZp77wrofpd_mlBDwxgF3adMyHYFanE,144
15
- imagebaker/list_views/annotation_list.py,sha256=HGV6lGlkFjvJvvGnCcLuX1kkfXA0GL8wKo8jOXSBXec,7527
15
+ imagebaker/list_views/annotation_list.py,sha256=3AN9uv-RcKFrJidfdC8R2m_tIbvf4IPRYcea4fCB5j4,7604
16
16
  imagebaker/list_views/canvas_list.py,sha256=JYSYR0peGyJFJ6amL1894KsUHETPUkR3qAWdGL50Lbc,6717
17
- imagebaker/list_views/image_list.py,sha256=NInkc893FGU7L6oSxy8KrWql-i6RB0BqvkroPAASjVw,4912
17
+ imagebaker/list_views/image_list.py,sha256=kS6IMPhsyYXHZvx9lrUgPLmbZgNoiLlbFJW6wS6icjU,5582
18
18
  imagebaker/list_views/layer_list.py,sha256=fLx3Ry72fas1W5y_V84hSp41ARneogQN3qjfYTOcpxY,14476
19
- imagebaker/list_views/layer_settings.py,sha256=0WVSCm_RSBKo4pCkYU5c2OYjb_sW8x0UUfFC4So26jQ,9752
19
+ imagebaker/list_views/layer_settings.py,sha256=KT0B4yIjR9DQmekIDh_TS0gBB6OkjdNBIZ1HnCFdUto,11025
20
20
  imagebaker/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  imagebaker/models/base_model.py,sha256=4RyS4vShqWFHhdQDwYluwTPnRPEXjpZl9UjYY_w8NL0,4203
22
22
  imagebaker/tabs/__init__.py,sha256=ijg7MA17RvcHA2AuZE4OgRJXWxjecaUAlfASKAoCQ6Q,86
23
- imagebaker/tabs/baker_tab.py,sha256=yFQRiNmLIua5BvgW7Ysj5FrNbTLhGxqGRTRCABxeTtw,20493
24
- imagebaker/tabs/layerify_tab.py,sha256=Qsf9w81-43sB0LZy_vIB4wCzUhHHhoIiarZJvKRxeZ0,32340
23
+ imagebaker/tabs/baker_tab.py,sha256=8V1t-cDCSotz6ZDv6o-6HA8H9eli5_0vVBPkkUP9_x4,23091
24
+ imagebaker/tabs/layerify_tab.py,sha256=4kbWOgDszuYEFI6VOrzqFpwvBAxe_ihFayubul30lz8,42703
25
25
  imagebaker/utils/__init__.py,sha256=I1z5VVEf6QPOMvVkgVHDauQ9ew7tcTVguV4Kdi3Lk4Y,130
26
- imagebaker/utils/image.py,sha256=fq7g3DqSdjF9okxZ3fe5kF4Hxn32rqhvVqxy8yI5bnI,3067
27
- imagebaker/utils/state_utils.py,sha256=Y2JVRGVfsoffwfA2lsCcqHwIxH_jOrEJAdH-oWfe2XE,3841
26
+ imagebaker/utils/image.py,sha256=2-wbwD3PMwefgswge0drFM1XfXE7yQ64lqZZ5PwyCWs,3165
27
+ imagebaker/utils/state_utils.py,sha256=6ivXVvamuYHQ6LjfoRIAuiTiZ4-LxUad22fvCH0CBcE,3932
28
28
  imagebaker/utils/transform_mask.py,sha256=k8MfTgM5-_U2TvDHQHRelz-leGFX6OcsllV6-J4BKfw,3651
29
29
  imagebaker/utils/utils.py,sha256=MnJ4flxxwZbjROWJ5iKHnJxPSSMbfWRbF9GKfVcKutA,840
30
30
  imagebaker/utils/vis.py,sha256=f7c44gm6g9ja5hgVeXKfOhHzxHdzXcIUwKiA1RZU_F8,4736
31
31
  imagebaker/window/__init__.py,sha256=FIxtUR1qnbQMYzppQv7tEfv1-ueHhpu0Z7xuWZR794w,44
32
32
  imagebaker/window/app.py,sha256=e6FGO_BnvkiQC9JN3AmqkgbF72zzZS0hc7PFc43QiVc,4725
33
- imagebaker/window/main_window.py,sha256=gpJ7DDuPmxhHh_6Rv3YH2J_1AqG7-NM8R3tKNYhFT3E,7030
33
+ imagebaker/window/main_window.py,sha256=lpfTffUOKZx6rN_9uP1OQ3A2GRdRKzQYcDn-GZxAuLg,11342
34
34
  imagebaker/workers/__init__.py,sha256=XfXENwAYyNg9q_zR-gOsYJGjzwg_iIb_gING8ydnp9c,154
35
- imagebaker/workers/baker_worker.py,sha256=EJTL4ln09NuntFpu0o-Hfk0vCtDxpKqJxJcmtgTnMwo,11297
35
+ imagebaker/workers/baker_worker.py,sha256=Bg5gcO91Ip1Egvs_hy9reQrsGNssbS7_nn_oYsmX5mE,12164
36
36
  imagebaker/workers/layerify_worker.py,sha256=EOqKvhdACtf3y5Ljy6M7MvddAjlZW5DNfBFMtNPD-us,3223
37
37
  imagebaker/workers/model_worker.py,sha256=Tlg6_D977iK-kuGCNdQY4OnGiP8QqWY7adpRNXZw4rA,1636
38
- imagebaker-0.0.50.dist-info/LICENSE,sha256=1vkysFPOnT7y4LsoFTv9YsopIrQvBc2l6vUOfv4KKLc,1082
39
- imagebaker-0.0.50.dist-info/METADATA,sha256=Zsl37tIGiV9wrQ2zfiaubhmPbhOMucos2V_fF5mtbXU,6829
40
- imagebaker-0.0.50.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
41
- imagebaker-0.0.50.dist-info/entry_points.txt,sha256=IDjZHJCiiHpH5IUTByT2en0nMbnnnlrJZ5FPFehUvQM,61
42
- imagebaker-0.0.50.dist-info/top_level.txt,sha256=Gg-eILTlqJXwVQr0saSwsx3-H4SPdZ2agBZaufe194s,11
43
- imagebaker-0.0.50.dist-info/RECORD,,
38
+ imagebaker-0.0.53.dist-info/LICENSE,sha256=1vkysFPOnT7y4LsoFTv9YsopIrQvBc2l6vUOfv4KKLc,1082
39
+ imagebaker-0.0.53.dist-info/METADATA,sha256=_PgfaiQ55tSgQ-kZyPA-qc35RlpfFFf_n1aB3WXLLgw,8382
40
+ imagebaker-0.0.53.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
41
+ imagebaker-0.0.53.dist-info/entry_points.txt,sha256=IDjZHJCiiHpH5IUTByT2en0nMbnnnlrJZ5FPFehUvQM,61
42
+ imagebaker-0.0.53.dist-info/top_level.txt,sha256=Gg-eILTlqJXwVQr0saSwsx3-H4SPdZ2agBZaufe194s,11
43
+ imagebaker-0.0.53.dist-info/RECORD,,