Skip to content

Commit

Permalink
Bump version to v2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
CVHub520 committed Aug 29, 2024
1 parent 5c498c2 commit 6186dcf
Show file tree
Hide file tree
Showing 27 changed files with 18,679 additions and 16,338 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
## 🥳 What's New

- Aug. 2024:
- 🤗 Pre-release the latest version [2.4.0](https://github.com/CVHub520/X-AnyLabeling/releases/tag/v2.4.0) 🤗
- 🤗 Release the latest version [2.4.1](https://github.com/CVHub520/X-AnyLabeling/releases/tag/v2.4.1) 🤗
- 🔥🔥🔥 Support [tracking-by-det/obb/seg/pose](./examples/multiple_object_tracking/README.md) tasks.
- ✨✨✨ Support [Segment-Anything-2](https://github.com/facebookresearch/segment-anything-2) model! (Recommended)
- 👏👏👏 Support [Grounding-SAM2](./docs/en/model_zoo.md) model.
Expand Down
2 changes: 1 addition & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
## 🥳 新功能

- 2024年8月:
- 🤗 预发布[X-AnyLabeling v2.4.0](https://github.com/CVHub520/X-AnyLabeling/releases/tag/v2.4.0)最新版本 🤗
- 🤗 发布[X-AnyLabeling v2.4.1](https://github.com/CVHub520/X-AnyLabeling/releases/tag/v2.4.1)最新版本 🤗
- 🔥🔥🔥 支持[tracking-by-det/obb/seg/pose](./examples/multiple_object_tracking/README.md)任务。
- ✨✨✨ 支持[Segment-Anything-2](https://github.com/facebookresearch/segment-anything-2)模型。
- 👏👏👏 支持[Grounding-SAM2](./docs/zh_cn/model_zoo.md)模型。
Expand Down
2 changes: 1 addition & 1 deletion anylabeling/app_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__appname__ = "X-AnyLabeling"
__appdescription__ = "Advanced Auto Labeling Solution with Added Features"
__version__ = "2.4.0"
__version__ = "2.4.1"
__preferred_device__ = "CPU" # GPU or CPU
Binary file modified anylabeling/resources/images/icon.icns
Binary file not shown.
Binary file modified anylabeling/resources/images/icon.ico
Binary file not shown.
Binary file modified anylabeling/resources/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified anylabeling/resources/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33,660 changes: 17,912 additions & 15,748 deletions anylabeling/resources/resources.py

Large diffs are not rendered by default.

587 changes: 315 additions & 272 deletions anylabeling/resources/translations/en_US.ts

Large diffs are not rendered by default.

Binary file modified anylabeling/resources/translations/zh_CN.qm
Binary file not shown.
586 changes: 317 additions & 269 deletions anylabeling/resources/translations/zh_CN.ts

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions anylabeling/services/auto_labeling/edge_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ def __init__(self, config_path, on_message) -> None:
if clip_txt_model_path and clip_img_model_path:
if self.config["model_type"] == "cn_clip":
clip_txt_model_path = self.get_model_abs_path(
self.config, "txt_model_path")
self.config, "txt_model_path"
)
_ = self.get_model_abs_path(self.config, "txt_extra_path")
clip_img_model_path = self.get_model_abs_path(
self.config, "img_model_path")
self.config, "img_model_path"
)
_ = self.get_model_abs_path(self.config, "img_extra_path")
model_arch = self.config["model_arch"]
self.clip_net = ChineseClipONNX(
Expand Down
6 changes: 4 additions & 2 deletions anylabeling/services/auto_labeling/sam_hq.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,12 @@ def __init__(self, config_path, on_message) -> None:
if clip_txt_model_path and clip_img_model_path:
if self.config["model_type"] == "cn_clip":
clip_txt_model_path = self.get_model_abs_path(
self.config, "txt_model_path")
self.config, "txt_model_path"
)
_ = self.get_model_abs_path(self.config, "txt_extra_path")
clip_img_model_path = self.get_model_abs_path(
self.config, "img_model_path")
self.config, "img_model_path"
)
_ = self.get_model_abs_path(self.config, "img_extra_path")
model_arch = self.config["model_arch"]
self.clip_net = ChineseClipONNX(
Expand Down
6 changes: 4 additions & 2 deletions anylabeling/services/auto_labeling/sam_med2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ def __init__(self, config_path, on_message) -> None:
if clip_txt_model_path and clip_img_model_path:
if self.config["model_type"] == "cn_clip":
clip_txt_model_path = self.get_model_abs_path(
self.config, "txt_model_path")
self.config, "txt_model_path"
)
_ = self.get_model_abs_path(self.config, "txt_extra_path")
clip_img_model_path = self.get_model_abs_path(
self.config, "img_model_path")
self.config, "img_model_path"
)
_ = self.get_model_abs_path(self.config, "img_extra_path")
model_arch = self.config["model_arch"]
self.clip_net = ChineseClipONNX(
Expand Down
6 changes: 4 additions & 2 deletions anylabeling/services/auto_labeling/segment_anything.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ def __init__(self, config_path, on_message) -> None:
if clip_txt_model_path and clip_img_model_path:
if self.config["model_type"] == "cn_clip":
clip_txt_model_path = self.get_model_abs_path(
self.config, "txt_model_path")
self.config, "txt_model_path"
)
_ = self.get_model_abs_path(self.config, "txt_extra_path")
clip_img_model_path = self.get_model_abs_path(
self.config, "img_model_path")
self.config, "img_model_path"
)
_ = self.get_model_abs_path(self.config, "img_extra_path")
model_arch = self.config["model_arch"]
self.clip_net = ChineseClipONNX(
Expand Down
6 changes: 4 additions & 2 deletions anylabeling/services/auto_labeling/segment_anything_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ def __init__(self, config_path, on_message) -> None:
if clip_txt_model_path and clip_img_model_path:
if self.config["model_type"] == "cn_clip":
clip_txt_model_path = self.get_model_abs_path(
self.config, "txt_model_path")
self.config, "txt_model_path"
)
_ = self.get_model_abs_path(self.config, "txt_extra_path")
clip_img_model_path = self.get_model_abs_path(
self.config, "img_model_path")
self.config, "img_model_path"
)
_ = self.get_model_abs_path(self.config, "img_extra_path")
model_arch = self.config["model_arch"]
self.clip_net = ChineseClipONNX(
Expand Down
4 changes: 3 additions & 1 deletion anylabeling/views/labeling/label_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,9 @@ def custom_to_mots(self, input_path, save_path):
with open(osp.join(save_path, "seqinfo.ini"), "w") as f:
config.write(f)
# Save gt.txt
with open(osp.join(save_path, "custom_gt.txt"), "w", encoding="utf-8") as f:
with open(
osp.join(save_path, "custom_gt.txt"), "w", encoding="utf-8"
) as f:
for row in mots_structure["gt"]:
f.write(" ".join(map(str, row)) + "\n")

Expand Down
42 changes: 26 additions & 16 deletions anylabeling/views/labeling/label_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,18 +640,14 @@ def __init__(
self.tr("&Label Manager"),
self.label_manager,
icon="edit",
tip=self.tr(
"Manage Labels: Rename, Delete, Adjust Color"
),
tip=self.tr("Manage Labels: Rename, Delete, Adjust Color"),
)
gid_manager = action(
self.tr("&Group ID Manager"),
self.gid_manager,
shortcuts["edit_group_id"],
icon="edit",
tip=self.tr(
"Manage Group ID"
),
tip=self.tr("Manage Group ID"),
)
union_selection = action(
self.tr("&Union Selection"),
Expand Down Expand Up @@ -1098,7 +1094,9 @@ def __init__(
self.export_mots_annotation,
None,
icon="format_mot",
tip=self.tr("Export Custom Multi-Object-Tracking-Segmentation Annotations"),
tip=self.tr(
"Export Custom Multi-Object-Tracking-Segmentation Annotations"
),
)
export_odvg_annotation = action(
self.tr("&Export ODVG Annotations"),
Expand Down Expand Up @@ -2107,8 +2105,9 @@ def save_mask(self):

default_color = QtGui.QColor(114, 114, 114)
color = QtWidgets.QColorDialog.getColor(
default_color, self,
self.tr("Select a color to use for masking the areas")
default_color,
self,
self.tr("Select a color to use for masking the areas"),
)
if not color.isValid():
return
Expand Down Expand Up @@ -2162,8 +2161,11 @@ def save_mask(self):
label = shape["label"]
points = shape["points"]
shape_type = shape["shape_type"]
if (label != "__mask__" or
shape_type not in ["rectangle", "polygon", "rotation"]):
if label != "__mask__" or shape_type not in [
"rectangle",
"polygon",
"rotation",
]:
continue
if (
(shape_type == "polygon" and len(points) < 3)
Expand All @@ -2172,16 +2174,24 @@ def save_mask(self):
):
continue
points = np.array(points, dtype=np.int32)
if shape['shape_type'] == 'rectangle':
if shape["shape_type"] == "rectangle":
top_left = tuple(points[0])
bottom_right = tuple(points[2])
cv2.rectangle(image, top_left, bottom_right, fill_color, thickness=-1)
elif shape['shape_type'] == 'rotation':
cv2.rectangle(
image,
top_left,
bottom_right,
fill_color,
thickness=-1,
)
elif shape["shape_type"] == "rotation":
rect = cv2.minAreaRect(points)
box = cv2.boxPoints(rect)
box = np.int0(box)
cv2.drawContours(image, [box], 0, fill_color, thickness=cv2.FILLED)
elif shape['shape_type'] == 'polygon':
cv2.drawContours(
image, [box], 0, fill_color, thickness=cv2.FILLED
)
elif shape["shape_type"] == "polygon":
cv2.fillPoly(image, [points], fill_color)
cv2.imwrite(bk_image_file, image)
# Update progress bar
Expand Down
5 changes: 4 additions & 1 deletion anylabeling/views/labeling/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numpy as np
from PyQt5 import QtGui


def img_data_to_pil(img_data):
f = io.BytesIO()
f.write(img_data)
Expand Down Expand Up @@ -40,7 +41,9 @@ def pil_to_qimage(img):
data = np.array(img)
height, width, channel = data.shape
bytes_per_line = 4 * width
qimage = QtGui.QImage(data, width, height, bytes_per_line, QtGui.QImage.Format_RGBA8888)
qimage = QtGui.QImage(
data, width, height, bytes_per_line, QtGui.QImage.Format_RGBA8888
)
return qimage


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ def on_new_model_loaded(self, model_config):
# Reset controls to initial values when the model changes
self.on_conf_value_changed(self.initial_conf_value)
self.on_iou_value_changed(self.initial_iou_value)
self.on_preserve_existing_annotations_state_changed(self.initial_preserve_annotations_state)
self.on_preserve_existing_annotations_state_changed(
self.initial_preserve_annotations_state
)
self.on_reset_tracker()

def on_output_modes_changed(self, output_modes, default_output_mode):
Expand Down
21 changes: 13 additions & 8 deletions anylabeling/views/labeling/widgets/label_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ def populate_table(self):
self.table_widget.insertRow(i)

old_gid_item = QTableWidgetItem(str(group_id))
old_gid_item.setFlags(old_gid_item.flags() ^ QtCore.Qt.ItemIsEditable)
old_gid_item.setFlags(
old_gid_item.flags() ^ QtCore.Qt.ItemIsEditable
)

new_gid_item = QTableWidgetItem("")
new_gid_item.setFlags(new_gid_item.flags() | QtCore.Qt.ItemIsEditable)
new_gid_item.setFlags(
new_gid_item.flags() | QtCore.Qt.ItemIsEditable
)

# Set QIntValidator to ensure only non-negative integers can be entered
validator = QIntValidator(0, 9999, self)
Expand All @@ -109,8 +113,8 @@ def confirm_changes(self):
line_edit = self.table_widget.cellWidget(i, 1)
new_gid = line_edit.text()
old_gid = old_gid_item.text()
# Only add to updated_gid_info

# Only add to updated_gid_info
# if the new group ID is not empty and different
if new_gid and old_gid != new_gid:
new_gid_info.append(new_gid)
Expand All @@ -132,7 +136,7 @@ def confirm_changes(self):
QtWidgets.QMessageBox.warning(
self,
"Warning",
"An error occurred while updating the Group IDs."
"An error occurred while updating the Group IDs.",
)

def modify_group_id(self, updated_gid_info):
Expand All @@ -144,7 +148,9 @@ def modify_group_id(self, updated_gid_info):
for shape in src_shapes:
group_id = int(shape.get("group_id"))
if group_id in updated_gid_info:
shape["group_id"] = updated_gid_info[group_id]["new_gid"]
shape["group_id"] = updated_gid_info[group_id][
"new_gid"
]
dst_shapes.append(shape)
data["shapes"] = dst_shapes
with open(shape_file, "w", encoding="utf-8") as f:
Expand Down Expand Up @@ -325,7 +331,6 @@ def on_delete_checkbox_changed(self, row, state):
delete_checkbox.setCheckable(True)

def confirm_changes(self):

total_num = self.table_widget.rowCount()
if total_num == 0:
self.reject()
Expand Down Expand Up @@ -670,7 +675,7 @@ def add_linking_pair(self):

def keyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Delete:
if hasattr(self, 'linking_list') and self.linking_list is not None:
if hasattr(self, "linking_list") and self.linking_list is not None:
selected_items = self.linking_list.selectedItems()
if selected_items:
for item in selected_items:
Expand Down
3 changes: 3 additions & 0 deletions docs/en/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ bash scripts/build_executable.sh linux-cpu

# Linux-GPU
bash scripts/build_executable.sh linux-gpu

# macOS
bash scripts/build_executable.sh macos
```

Note: If you encounter permission issues when executing the above commands on Windows, after ensuring the preparation steps above are completed, you can directly execute the following commands as needed:
Expand Down
5 changes: 4 additions & 1 deletion docs/zh_cn/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ python anylabeling/app.py

### 1.2 从 GUI 运行

> 下载链接: [Github](https://github.com/CVHub520/X-AnyLabeling/releases) | [百度网盘](https://pan.baidu.com/s/1uI9pDYuOh-59qINQ6wTS_g?pwd=s00l)
> 下载链接: [Github](https://github.com/CVHub520/X-AnyLabeling/releases) | [百度网盘](https://pan.baidu.com/s/1L1ADYN-DftcUicpieG-LDw?pwd=ydud)
相比于从源代码运行,GUI 运行环境提供了更便捷的体验,用户无需深入了解底层实现,只需解压便可直接使用。然而,其也存在一些问题,包括:
- **故障排除困难:** 如果发生崩溃或错误,可能难以快速定位具体原因,从而增加了故障排除的难度。
Expand Down Expand Up @@ -175,6 +175,9 @@ bash scripts/build_executable.sh linux-cpu

# Linux-GPU
bash scripts/build_executable.sh linux-gpu

# macOS
bash scripts/build_executable.sh macos
```

注意:如果在 Windows 上执行上述命令时遇到权限问题,在确保完成上述准备步骤后,可以根据需要直接执行以下命令:
Expand Down
1 change: 1 addition & 0 deletions requirements-macos-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r requirements-macos.txt
build
twine
pyinstaller
3 changes: 2 additions & 1 deletion scripts/build_executable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ elif [ $system = "linux-gpu" ];then
else
echo "Variable $variable_name has a different value: $variable_value (expected: $expected_value)"
fi

elif [ $system = "macos" ];then
pyinstaller --noconfirm x-anylabeling-macos.spec
else
echo "System value '$system' is not recognized."
fi
Loading

0 comments on commit 6186dcf

Please sign in to comment.