Merge pull request #14 from bmaltais/dev

fix issue with dataset balancing when the number of detected images i…
This commit is contained in:
bmaltais 2022-12-21 11:03:23 -05:00 committed by GitHub
commit b04b5bd6e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -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>`

View File

@ -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)