Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to input two different data format when training? #196

Open
vitahsu opened this issue Oct 30, 2020 · 0 comments
Open

How to input two different data format when training? #196

vitahsu opened this issue Oct 30, 2020 · 0 comments

Comments

@vitahsu
Copy link

vitahsu commented Oct 30, 2020

Hi, this is a perfect project!
BUT!! I have some problem that i want to input [.jpg, .npy] as my input data format. (Because my training data is .jpg and .npy file)
I have traced code and found i can change the code of def load_examples .
I also survey how to use tf.train.slice_input_producer to load two data at the same time.

SO I try to revise the code bellow:
from original code
with tf.name_scope("load_images"):
path_queue = tf.train.string_input_producer(input_paths, shuffle=a.mode == "train")
reader = tf.WholeFileReader()
paths, contents = reader.read(path_queue)
raw_input = decode(contents)
raw_input = tf.image.convert_image_dtype(raw_input, dtype=tf.float32)
paths_batch, inputs_batch, targets_batch = tf.train.batch([paths, input_images, target_images], batch_size=a.batch_size)

to
with tf.name_scope("load_images"):
image_jpg_datas = io.imread(image_jpg_paths)
anotherimage_npy_datas= np.load(anotherimage_npy_paths)
path_queue = tf.train.slice_input_producer([image_jpg_datas, anotherimage_npy_datas], shuffle=a.mode == "train")
inputs_batch, targets_batch = tf.train.batch(path_queue, batch_size=a.batch_size)

and when i change my code i found that it will almost out of memory and the code will be killed. (data is around 60k)
I have no idea how can i input .jpg and .npy data format at the same time successfully.
Does anyone have some advises?
Thank you very much ><

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant