Python Pix2pix: Image-to-image translation with a conditional GAN

AI Thread Summary
The discussion focuses on issues related to using a custom dataset with the Pix2pix image-to-image translation tutorial. The user is trying to understand the input to the `load_image_train` function, which accepts a single image filename and returns two processed images. They are encountering errors when mapping their own dataset, particularly when unzipping tuples of image paths. The user is also confused about the TensorFlow data types being printed during execution. Overall, the conversation highlights challenges in building an input pipeline with TensorFlow's `tf.data` API for custom datasets.
btb4198
Messages
570
Reaction score
10
So I am trying to do this tutorials but I want to use my own dataset. I am having problems "Build an input pipeline with tf.data."
My question is about their code:
[CODE title="load_image_train"]def load_image_train(image_file):
input_image, real_image = load(image_file)
input_image, real_image = random_jitter(input_image, real_image)
input_image, real_image = normalize(input_image, real_image)

return input_image, real_image[/CODE][CODE title="Build an input pipeline with tf.data"]train_dataset = tf.data.Dataset.list_files(str(PATH / 'train/*.jpg'))
train_dataset = train_dataset.map(load_image_train,
num_parallel_calls=tf.data.AUTOTUNE)
train_dataset = train_dataset.shuffle(BUFFER_SIZE)
train_dataset = train_dataset.batch(BATCH_SIZE)[/CODE]

when they call load_image_train, are they sending a list of images or just one image?
I am really not liking this Not displaying type stuff
 
Technology news on Phys.org
btb4198 said:
So I am trying to do this tutorials but I want to use my own dataset. I am having problems "Build an input pipeline with tf.data."
My question is about their code:
[CODE title="load_image_train"]def load_image_train(image_file):
input_image, real_image = load(image_file)
input_image, real_image = random_jitter(input_image, real_image)
input_image, real_image = normalize(input_image, real_image)

return input_image, real_image[/CODE][CODE title="Build an input pipeline with tf.data"]train_dataset = tf.data.Dataset.list_files(str(PATH / 'train/*.jpg'))
train_dataset = train_dataset.map(load_image_train,
num_parallel_calls=tf.data.AUTOTUNE)
train_dataset = train_dataset.shuffle(BUFFER_SIZE)
train_dataset = train_dataset.batch(BATCH_SIZE)[/CODE]

when they call load_image_train, are they sending a list of images or just one image?
I am really not liking this Not displaying type stuff
What looks to me like what's happening is that load_image_train has a single image file as its input, but returns two image files: input_image and real_image.
 
btb4198 said:
when they call load_image_train, are they sending a list of images or just one image?
The load_image_train function takes a single image filename as its argument.

The effect of the map method call is to call load_image_train once for each filename in a list of filenames returned by the list_files method call.
 
I am getting a very weird error when I am trying to Build an input pipeline with tf.data. I am combining my reference image and my drawing into a tuple. Then I added to that to list. This should work,
but now I am getting this weird error at this line:
train_dataset = train_dataset.map(load_image_train, num_parallel_calls=tf.data.AUTOTUNE)

Here is my code:
Code:
@tf.function()
def load_image_train(a_training_datapoint):
 print(type(a_training_datapoint))
 print("here 1")
 real_image_path, drawing_path = zip(*a_training_datapoint)
 print("here 2")
 real_image = convert_images_to_tensor(real_image_path)
 print("here 3")
 drawing_image = convert_images_to_tensor(drawing_path)
 real_image, drawing_image = random_jitter(real_image, drawing_image)
 real_image, drawing_image = normalize(real_image, drawing_image)
return real_image, drawing_image

and then I have this:

Code:
test_dataset_list = []
for data in test_set:
 test_dataset_list.append(zip(data.reference_image, data.drawing))
print(test_dataset_list)
Here 1 is the only one that prints out.

so it seem to not like how I am unzipping my tuple, but I am sure I am doing it right.

Also it say this : <class 'tensorflow.python.framework.ops.Tensor'>

when I am printing out the type for the a_test_datapoint
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
2
Views
1K
Back
Top