Skip to content

Commit d936091

Browse files
committed
2 parents 7f8cca3 + 02c3b89 commit d936091

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

keras_wrapper/dataset.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ def setRawInput(self, path_list, set_name, type='file-name', id='raw-text', over
646646
if id not in self.ids_inputs or overwrite_split:
647647
self.ids_inputs.append(id)
648648
self.types_inputs.append(type)
649-
self.optional_inputs.append(id) # This is always optional
649+
if id not in self.optional_inputs:
650+
self.optional_inputs.append(id) # This is always optional
650651
elif id in keys_X_set and not overwrite_split:
651652
raise Exception('An input with id "' + id + '" is already loaded into the Database.')
652653

@@ -723,7 +724,7 @@ def setInput(self, path_list, set_name, type='raw-image', id='image', repeat_set
723724
elif id in keys_X_set and not overwrite_split:
724725
raise Exception('An input with id "' + id + '" is already loaded into the Database.')
725726

726-
if not required:
727+
if not required and id not in self.optional_inputs:
727728
self.optional_inputs.append(id)
728729

729730
if type not in self.__accepted_types_inputs:
@@ -819,7 +820,8 @@ def setRawOutput(self, path_list, set_name, type='file-name', id='raw-text', ove
819820
if id not in self.ids_inputs or overwrite_split:
820821
self.ids_inputs.append(id)
821822
self.types_inputs.append(type)
822-
self.optional_inputs.append(id) # This is always optional
823+
if id not in self.optional_inputs:
824+
self.optional_inputs.append(id) # This is always optional
823825

824826
elif id in keys_Y_set and not overwrite_split:
825827
raise Exception('An input with id "' + id + '" is already loaded into the Database.')
@@ -3377,17 +3379,18 @@ def __checkLengthSet(self, set_name):
33773379
"""
33783380
if eval('self.loaded_' + set_name + '[0] and self.loaded_' + set_name + '[1]'):
33793381
lengths = []
3382+
plot_ids_in = []
33803383
for id_in in self.ids_inputs:
33813384
if id_in not in self.optional_inputs:
3382-
exec ('lengths.append(len(self.X_' + set_name + '[id_in]))')
3385+
plot_ids_in.append(id_in)
3386+
exec('lengths.append(len(self.X_' + set_name + '[id_in]))')
33833387
for id_out in self.ids_outputs:
33843388
exec ('lengths.append(len(self.Y_' + set_name + '[id_out]))')
33853389
if lengths[1:] != lengths[:-1]:
33863390
raise Exception('Inputs and outputs size '
33873391
'(' + str(lengths) + ') for "' + set_name + '" set do not match.\n'
3388-
'\t Inputs:' + str(self.ids_inputs) + ''
3389-
'\t Outputs:' + str(
3390-
self.ids_outputs))
3392+
'\t Inputs:' + str(plot_ids_in) + ''
3393+
'\t Outputs:' + str(self.ids_outputs))
33913394

33923395
def __getNextSamples(self, k, set_name):
33933396
"""

0 commit comments

Comments
 (0)