Closed elichan5168 closed 1 day ago
Regarding your queries about X-AnyLabeling:
For your convenience, here's a Python script snippet to generate JSON files for importing pre-classified images into X-AnyLabeling:
import cv2
import json
def create_annotation_json(image_path, label, image_width, image_height):
annotation = {
"version": "2.3.5",
"flags": {},
"shapes": [
{
"label": label,
"points": [[0, 0], [image_width, 0], [image_width, image_height], [0, image_height]],
"group_id": None,
"shape_type": "rectangle",
"flags": {}
}
],
"imagePath": image_path,
"imageData": None,
"imageHeight": image_height,
"imageWidth": image_width
}
return annotation
# Example usage:
image_path = "path_to_your_image.jpg"
label = "your_label"
image = cv2.imread(image_path)
image_height, image_width, _ = image.shape()
annotation = create_annotation_json(image_path, label, image_width, image_height)
# Save the JSON to a file
with open("path_to_save_annotation.json", "w") as f:
json.dump(annotation, f, indent=4)
Remember to replace "path_to_your_image.jpg" and "your_label" with the actual path to your image and its corresponding classification label. Repeat this process for each image in your dataset.
This script generates a JSON file for each image, which you can then import into X-AnyLabeling. By doing so, you'll be able to leverage the existing classification labels while adding additional annotations as required.
Should you have further inquiries or require assistance with any other aspects of using X-AnyLabeling, feel free to ask. I'm here to help you make the most of this powerful annotation tool.
@CVHub520 Thx, the issue is resolved. Looking forward to you adding the image classification mode in the future.
你好,
我想问一些问题。
我有一个数据集图片需要先分类,想问X-Anylabeling能不能只做图片分类的标签,而不用把物体定位框(bbox)画出来呢?我没找到直接打标签的地方? (现在版本似乎必需要先定位才能选择分类标签) 和https://github.com/cvat-ai/cvat/issues/1465 (这个问题比较类似)
我还有另一个数据集,这个数据集只做了分类的标签,所以我想用X-Anylabeling先导入这部分已经分类好的分类标签,然后我再手动进行定位框的操作。这可以做到吗?(由于数据量太大,如果可以能节省很多时间)
另外我还发现一个bug. 在win10上我用的requirements-gpu.txt安装后加载模型会闪退。ubuntu不会。