Add conversion to FEN

This commit is contained in:
2025-12-22 16:30:07 +01:00
parent 86dea774e4
commit 0aaea36586
12 changed files with 246 additions and 105 deletions

View File

@@ -1,7 +1,8 @@
import os
labels_dir = "../datasets/corners/Outer Chess Corners.v1i.yolov11/valid/labels"
label_to_be_removed = 1
labels_dir = "C:/Users/Laurent/Desktop/board-mate/rpi/training/datasets/edges/misis2025_cv_chess.v1i.yolov11/valid/labels"
labels_to_be_removed = [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
for filename in os.listdir(labels_dir):
if not filename.endswith(".txt"):
@@ -20,13 +21,12 @@ for filename in os.listdir(labels_dir):
continue
cls = int(parts[0])
if cls == label_to_be_removed:
if cls in labels_to_be_removed:
print(f"{parts} found in {filename}")
continue
cls = 0
new_lines.append(" ".join([str(cls)] + parts[1:]))
# Overwrite file with updated indices
with open(txt_path, "w") as f:
f.write("\n".join(new_lines))