Merge pull request #14 from bmaltais/dev
fix issue with dataset balancing when the number of detected images i…
This commit is contained in:
commit
b04b5bd6e5
@ -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>`
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user