diff --git a/README.md b/README.md index 38254d5..ef843b6 100644 --- a/README.md +++ b/README.md @@ -14,5 +14,8 @@ You can find the finetune solution spercific [Finetune README](README_finetune.m ## Change history -* 12/21 (v9.7) update: +* 12/21 (v18.6.1) update: + - fix issue with dataset balancing when the number of detected images in the folder is 0 + +* 12/21 (v18.6) update: - add optional GUI authentication support via: `python fine_tune.py --username= --password=` \ No newline at end of file diff --git a/library/dataset_balancing_gui.py b/library/dataset_balancing_gui.py index d109cfb..867c881 100644 --- a/library/dataset_balancing_gui.py +++ b/library/dataset_balancing_gui.py @@ -50,12 +50,16 @@ def dataset_balancing(concept_repeats, folder, insecure): match = re.match(r'^\{(\d+\.?\d*)\}', subdir) if match: # Multiply the repeats value by the number inside the braces - repeats = max( - 1, round(concept_repeats / images * float(match.group(1))) - ) + if not images == 0: + repeats = max(1, round(concept_repeats / images * float(match.group(1)))) + else: + repeats = 0 subdir = subdir[match.end() :] else: - repeats = max(1, round(concept_repeats / images)) + if not images == 0: + repeats = max(1, round(concept_repeats / images)) + else: + repeats = 0 # Check if the subdirectory name already has a number at the beginning match = re.match(r'^\d+_', subdir)