From 6c20b329b24e61bb2602245788a35af0d05da835 Mon Sep 17 00:00:00 2001 From: Shaun Date: Thu, 16 May 2024 00:17:11 +0800 Subject: [PATCH] Update x2coco.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了voc下label包含空格的情况 --- tools/x2coco.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/x2coco.py b/tools/x2coco.py index 78e8619b42e..1d6833e93d0 100644 --- a/tools/x2coco.py +++ b/tools/x2coco.py @@ -189,8 +189,7 @@ def deal_json(ds_type, img_path, json_path): def voc_get_label_anno(ann_dir_path, ann_ids_path, labels_path): - with open(labels_path, 'r') as f: - labels_str = f.read().split() + labels_str = [line.strip() for line in open(labels_path)] labels_ids = list(range(1, len(labels_str) + 1)) with open(ann_ids_path, 'r') as f: