Skip to content

Commit

Permalink
Fixed issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
realtimshady1 committed Jul 15, 2021
1 parent 6299ab4 commit 26ef998
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions write_datasets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import argparse
import random
from collections import Counter

'''
Expand Down Expand Up @@ -30,12 +29,10 @@ def write_datasets(args):
number_of_images = len(images)

index_valid = round(number_of_images * args.valid_pct / 100)
validfiles = random.sample(images, index_valid)
traintestfiles = list(set(images).difference(set(validfiles)))
index_train = round(len(traintestfiles) *
(args.train_pct / (100 - args.valid_pct)))
trainfiles = random.sample(traintestfiles, index_train)
testfiles = list(set(traintestfiles).difference(set(trainfiles)))
index_train = round(number_of_images * args.train_pct / 100)
validfiles = images[:index_valid]
trainfiles = images[index_valid:(index_valid+index_train)]
testfiles = images[(index_valid+index_train):]

print('Number of images:', number_of_images)

Expand Down

0 comments on commit 26ef998

Please sign in to comment.