0

I'm training a model on multiple images. I tried using the from_tensor_slices method https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensor_slices Very botched but just to see if it worked like so:

first = True
train, label = glob.glob(fp/*.tif), glob.glob(fp/*.tif)


for i,l in zip(train,label):
    im = IO.imread(i)
    label = IO.imread(l)
    
    if first:
        dataset = tf.data.Dataset.from_tensor_slices((im, label))
        first = False
        print('ran')
    
        
    else:
        ds = tf.data.Dataset.from_tensor_slices((im, label))
        dataset = dataset.concatenate(ds)

but this errors out. I have then tried the generator option here: Failed copying input tensor from CPU to GPU in order to run GatherVe: Dst tensor is not initialized. [Op:GatherV2]

But cannot work out how I would edit it to work with multiple paired images which would be too big to open and combine into a two np arrays before putting into the generator?

svollowork
  • 78
  • 7

0 Answers0