Reputation: 81
I have two tensors one real_image_tensors and one drawing_tensors they are both currently in order, where the first image in real_image_tensors is the reference picture for the drawing in drawing_tensor. I need to keep them in order, but split them into a training set tensor and a testing set tensor. So I would have four different tensors.
ok here is my code:
num_images = len(real_image_tensors)
num_training = int(num_images * 0.8)
num_test = num_images - num_training
training_real_image_tensors = real_image_tensors[0:num_training]
training_drawing_tensors = drawing_tensors[0:num_training]
test_real_image_tensors = real_image_tensors[num_training:num_images]
test_drawing_tensors = drawing_tensors[num_training:len(drawing_tensors)]
I thought this worked until I print out an image in all 4 tensors using :
plt.Figure()
plt.imshow(training_real_image_tensors)
and I learned that when I print out the images in the test it Crops out part of the images. see:
yeah this did not work out at all like how I thought it would.
And when I use model_selection.train_test_split(), it Shuffle my images and I need to keep them in order, because again the Reference pictures for the drawings are in the same corresponding indexes and I need to keep like that for my Pix2Pix Gan.
Upvotes: 0
Views: 122
Reputation: 31
One approach you can try is the following:
.train_test_split()
Let me know if that works!
Upvotes: 2