Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue with dataset balancing when the number of detected images i… #14

Merged
merged 1 commit into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<name> --password=<password>`
12 changes: 8 additions & 4 deletions library/dataset_balancing_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down