lazylabel-gui 1.0.6__py3-none-any.whl → 1.0.8__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.
@@ -3,7 +3,6 @@ from PyQt6.QtWidgets import QTableWidgetItem
3
3
 
4
4
  class NumericTableWidgetItem(QTableWidgetItem):
5
5
  def __lt__(self, other):
6
- # Override the default less-than operator for sorting
7
6
  try:
8
7
  return int(self.text()) < int(other.text())
9
8
  except (ValueError, TypeError):
lazylabel/photo_viewer.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from PyQt6.QtCore import Qt, QRectF
2
- from PyQt6.QtGui import QPixmap
2
+ from PyQt6.QtGui import QPixmap, QCursor
3
3
  from PyQt6.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsPixmapItem
4
4
 
5
5
 
@@ -21,8 +21,7 @@ class PhotoViewer(QGraphicsView):
21
21
  rect = QRectF(self._pixmap_item.pixmap().rect())
22
22
  if not rect.isNull():
23
23
  self.setSceneRect(rect)
24
- unity = self.transform().mapRect(QRectF(0, 0, 1, 1))
25
- self.scale(1 / unity.width(), 1 / unity.height())
24
+ self.resetTransform()
26
25
  viewrect = self.viewport().rect()
27
26
  scenerect = self.transform().mapRect(rect)
28
27
  factor = min(
@@ -30,6 +29,7 @@ class PhotoViewer(QGraphicsView):
30
29
  viewrect.height() / scenerect.height(),
31
30
  )
32
31
  self.scale(factor, factor)
32
+ self.centerOn(self._pixmap_item)
33
33
 
34
34
  def set_photo(self, pixmap):
35
35
  if pixmap and not pixmap.isNull():
@@ -38,6 +38,9 @@ class PhotoViewer(QGraphicsView):
38
38
  else:
39
39
  self._pixmap_item.setPixmap(QPixmap())
40
40
 
41
+ def set_cursor(self, cursor_shape):
42
+ self.viewport().setCursor(QCursor(cursor_shape))
43
+
41
44
  def resizeEvent(self, event):
42
45
  self.fitInView()
43
46
  super().resizeEvent(event)
@@ -34,11 +34,13 @@ class ReorderableClassTable(QTableWidget):
34
34
  list({index.row() for index in self.selectedIndexes()}), reverse=True
35
35
  )
36
36
 
37
- dragged_items = []
37
+ dragged_rows_data = []
38
38
  for row in selected_rows:
39
- # Take the item from the row and keep its data
40
- item = self.takeItem(row, 0)
41
- dragged_items.insert(0, item)
39
+ # Take all items from the row
40
+ row_data = [
41
+ self.takeItem(row, col) for col in range(self.columnCount())
42
+ ]
43
+ dragged_rows_data.insert(0, row_data)
42
44
  # Then remove the row itself
43
45
  self.removeRow(row)
44
46
 
@@ -47,10 +49,11 @@ class ReorderableClassTable(QTableWidget):
47
49
  if row < drop_row:
48
50
  drop_row -= 1
49
51
 
50
- # Insert items at the new location
51
- for item in dragged_items:
52
+ # Insert rows and their items at the new location
53
+ for row_data in dragged_rows_data:
52
54
  self.insertRow(drop_row)
53
- self.setItem(drop_row, 0, item)
55
+ for col, item in enumerate(row_data):
56
+ self.setItem(drop_row, col, item)
54
57
  self.selectRow(drop_row)
55
58
  drop_row += 1
56
59
 
lazylabel/utils.py CHANGED
@@ -2,10 +2,10 @@ import numpy as np
2
2
  from PyQt6.QtGui import QImage, QPixmap
3
3
 
4
4
 
5
- def mask_to_pixmap(mask, color):
5
+ def mask_to_pixmap(mask, color, alpha=150):
6
6
  colored_mask = np.zeros((mask.shape[0], mask.shape[1], 4), dtype=np.uint8)
7
7
  colored_mask[mask, :3] = color
8
- colored_mask[mask, 3] = 150 # Alpha channel for transparency
8
+ colored_mask[mask, 3] = alpha
9
9
  image = QImage(
10
10
  colored_mask.data, mask.shape[1], mask.shape[0], QImage.Format.Format_RGBA8888
11
11
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lazylabel-gui
3
- Version: 1.0.6
3
+ Version: 1.0.8
4
4
  Summary: An image segmentation GUI for generating mask tensors.
5
5
  Author-email: "Deniz N. Cakan" <deniz.n.cakan@gmail.com>
6
6
  License: MIT License
@@ -48,7 +48,7 @@ Requires-Dist: tqdm>=4.67.1
48
48
  Dynamic: license-file
49
49
 
50
50
  # <img src="https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/logo2.png" alt="LazyLabel Logo" style="height:60px; vertical-align:middle;" /> <img src="https://raw.githubusercontent.com/dnzckn/LazyLabel/main/src/lazylabel/demo_pictures/logo_black.png" alt="LazyLabel Cursive" style="height:60px; vertical-align:middle;" />
51
- LazyLabel is an intuitive, AI-assisted image segmentation tool. It uses Meta's Segment Anything Model (SAM) for quick, precise mask generation, alongside advanced polygon editing for fine-tuned control. Outputs are saved in a clean, one-hot encoded format for easy machine learning integration.
51
+ LazyLabel is an intuitive, AI-assisted image segmentation tool. It uses Meta's Segment Anything Model (SAM) for quick, precise mask generation, alongside advanced polygon editing for fine-tuned control. Outputs are saved in a clean, one-hot encoded `.npz` format for easy machine learning integration and in YOLO `.txt` format.
52
52
 
53
53
  Inspired by [LabelMe](https://github.com/wkentaro/labelme?tab=readme-ov-file#installation) and [Segment-Anything-UI](https://github.com/branislavhesko/segment-anything-ui/tree/main).
54
54
 
@@ -0,0 +1,17 @@
1
+ lazylabel/controls.py,sha256=kminJPdKDzrSacTaUuLYXVW_nyTOcoGV_iWlMHyOfsA,10533
2
+ lazylabel/custom_file_system_model.py,sha256=q4axrAQPQeURVz-sFeVl4s9pyY05OE9A2Ej95Ju1rXM,2488
3
+ lazylabel/editable_vertex.py,sha256=itGcZG5MyuctGfxjINu8IJBYFFsCGuE_YtsrfHICjiw,1115
4
+ lazylabel/hoverable_pixelmap_item.py,sha256=kJFOp7WXiyHpNf7l73TZjiob85jgP30b5MZvu_z5L3c,728
5
+ lazylabel/hoverable_polygon_item.py,sha256=-0l8C8PfsXtJGqvZZ2qtizxHmFwO8RCwz5UfjKpDvzY,775
6
+ lazylabel/main.py,sha256=C-ZHVFzAbnGPRDFCBTLvn3uBMuu_qq4UUsfF8cZmdns,50862
7
+ lazylabel/numeric_table_widget_item.py,sha256=dQUlIFu9syCxTGAHVIlmbgkI7aJ3f3wmDPBz1AGK9Bg,283
8
+ lazylabel/photo_viewer.py,sha256=PNgm0gU2gnIqvRkrGlQugdobGsKwAi3m3X6ZF487lCo,2055
9
+ lazylabel/reorderable_class_table.py,sha256=4c-iuSkPcmk5Aey5n2zz49O85x9TQPujKG-JLxtuBCo,2406
10
+ lazylabel/sam_model.py,sha256=9NB51Xq1P5dIxZMBdttwwRlszlJR3U5HRs83QsPLxNE,2595
11
+ lazylabel/utils.py,sha256=sYSCoXL27OaLgOZaUkCAhgmKZ7YfhR3Cc5F8nDIa3Ig,414
12
+ lazylabel_gui-1.0.8.dist-info/licenses/LICENSE,sha256=kSDEIgrWAPd1u2UFGGpC9X71dhzrlzBFs8hbDlENnGE,1092
13
+ lazylabel_gui-1.0.8.dist-info/METADATA,sha256=1JlchgipzdT-mspfXCovQ1FalX0vyg4jdxFfaK1F9eA,6292
14
+ lazylabel_gui-1.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ lazylabel_gui-1.0.8.dist-info/entry_points.txt,sha256=Hd0WwEG9OPTa_ziYjiD0aRh7R6Fupt-wdQ3sspdc1mM,54
16
+ lazylabel_gui-1.0.8.dist-info/top_level.txt,sha256=YN4uIyrpDBq1wiJaBuZLDipIzyZY0jqJOmmXiPIOUkU,10
17
+ lazylabel_gui-1.0.8.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- lazylabel/controls.py,sha256=YCTm8hQMgk4GFrr7b8p5p8PX3IQi9NoWZV1EFYEhDI8,4125
2
- lazylabel/custom_file_system_model.py,sha256=c1cxQqrfZ7d0Tz9kHpygiIEqw4ffuEBjkD8wjumNaSY,2005
3
- lazylabel/editable_vertex.py,sha256=lw_MmDmgkiPZbouIb6DkqIEJZhG32AJ2T2TUt0P3rWk,1040
4
- lazylabel/hoverable_polygon_item.py,sha256=-0l8C8PfsXtJGqvZZ2qtizxHmFwO8RCwz5UfjKpDvzY,775
5
- lazylabel/main.py,sha256=EUTmxS2AiJ7BEYkKIkCfhn2rraxZHX00kQ98eMTnxy0,35234
6
- lazylabel/numeric_table_widget_item.py,sha256=ZnwaUvCeOGEX504DfbLHWKMKVMt5zSjdQkPjPCuYCcY,346
7
- lazylabel/photo_viewer.py,sha256=qZ6t9RO0TOXQuoLr6ASVy6sgSIcVFPwyNRnjkK5MIHc,1993
8
- lazylabel/reorderable_class_table.py,sha256=9BctudGTrb6dTV8_7IpQ5lMM0D-5unuQbLVk3Yu49xQ,2242
9
- lazylabel/sam_model.py,sha256=9NB51Xq1P5dIxZMBdttwwRlszlJR3U5HRs83QsPLxNE,2595
10
- lazylabel/utils.py,sha256=a2n2f4NehzSjS8-UwbOioYTSO_lWe1uYjzDdOIEJloE,435
11
- lazylabel_gui-1.0.6.dist-info/licenses/LICENSE,sha256=kSDEIgrWAPd1u2UFGGpC9X71dhzrlzBFs8hbDlENnGE,1092
12
- lazylabel_gui-1.0.6.dist-info/METADATA,sha256=uHTTXfYNtNuazxOxyWIdBwt9TRM0B4htdfH8LhgGyd4,6259
13
- lazylabel_gui-1.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- lazylabel_gui-1.0.6.dist-info/entry_points.txt,sha256=Hd0WwEG9OPTa_ziYjiD0aRh7R6Fupt-wdQ3sspdc1mM,54
15
- lazylabel_gui-1.0.6.dist-info/top_level.txt,sha256=YN4uIyrpDBq1wiJaBuZLDipIzyZY0jqJOmmXiPIOUkU,10
16
- lazylabel_gui-1.0.6.dist-info/RECORD,,