Skip to content
Snippets Groups Projects
Commit d030cfb3 authored by François  LAURENT's avatar François LAURENT
Browse files

bugfix for files with missing labels

parent 0db3975e
No related branches found
No related tags found
3 merge requests!9Set of commits to be tagged 0.16,!7Save larva_dataset file along with model files,!6sample_size argument and check_larva_dataset_hdf5 function
Pipeline #110160 passed
......@@ -896,7 +896,7 @@ function samplesize!(index, sample_size)
while count < targetcount
file = rand(keys(targetcountsperfile))
counts = targetcountsperfile[file]
if counts[label] < index.maxcounts[file][label]
if haskey(counts, label) && counts[label] < index.maxcounts[file][label]
counts[label] += 1
count += 1
end
......@@ -904,7 +904,7 @@ function samplesize!(index, sample_size)
while targetcount < count
file = rand(keys(targetcountsperfile))
counts = targetcountsperfile[file]
if 0 < counts[label]
if 0 < get(counts, label, 0)
counts[label] -= 1
count -= 1
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment