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

Click For Summary

Discussion Overview

The discussion revolves around using a custom dataset with the Pix2pix image-to-image translation model, specifically focusing on building an input pipeline using TensorFlow's tf.data API. Participants are troubleshooting issues related to the implementation of the load_image_train function and its interaction with the dataset.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • Some participants question whether the load_image_train function receives a list of images or just a single image file as input.
  • One participant suggests that load_image_train takes a single image filename and returns two images, input_image and real_image.
  • Another participant clarifies that the map method calls load_image_train for each filename in the list generated by the list_files method.
  • A participant describes encountering an error when trying to build the input pipeline, specifically related to unzipping tuples of image paths and the type of the data being processed.
  • Concerns are raised about the output type of the data points being processed, with one participant noting that only one print statement executes, indicating a potential issue in the code.

Areas of Agreement / Disagreement

Participants generally agree that the load_image_train function is designed to handle single image files, but there is uncertainty regarding the specifics of how the dataset is being constructed and processed, leading to unresolved issues in the implementation.

Contextual Notes

Participants express limitations in their understanding of how to correctly format and process their dataset, particularly in relation to the expected input types for the functions being used.

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
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K