Skip to content

Commit

Permalink
symlink -> link, move dataset_dict_loader
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanklut committed Dec 1, 2023
1 parent fbf115d commit d56c3fb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def preprocess_datasets(
train_output_dir = None
if train is not None:
train = clean_input_paths(train)
if not all(missing := path.exists() for path in train):
if not all((missing := path).exists() for path in train):
raise FileNotFoundError(f"Train File/Folder not found: {missing} does not exist")

train_output_dir = output_dir.joinpath("train")
Expand Down
4 changes: 3 additions & 1 deletion datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ def register_dataset(path: str | Path, name: str, ignore_label: int = 255) -> Me
data = convert_to_paths(path, info["data"])
classes = info["classes"]

DatasetCatalog.register(name=name, func=lambda data=data: dataset_dict_loader(data))
list_of_dicts = dataset_dict_loader(data)

DatasetCatalog.register(name=name, func=lambda: list_of_dicts)

MetadataCatalog[name] = metadata_from_classes(classes, ignore_label)
return MetadataCatalog.get(name)
Expand Down
2 changes: 1 addition & 1 deletion datasets/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def save_image(
image_dir.mkdir(parents=True, exist_ok=True)

if self.resize_mode == "none":
copy_mode(image_path, out_image_path, mode="symlink")
copy_mode(image_path, out_image_path, mode="link")
else:
image = load_image_array_from_path(image_path)

Expand Down
2 changes: 1 addition & 1 deletion page_xml/output_pageXML.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def link_image(self, image_path: Path):
raise TypeError("Output dir is None")
image_output_path = self.output_dir.joinpath(image_path.name)

copy_mode(image_path, image_output_path, mode="symlink")
copy_mode(image_path, image_output_path, mode="link")

def generate_single_page(
self,
Expand Down

0 comments on commit d56c3fb

Please sign in to comment.