Preparing images to feed into tensorflow as datasets
up vote
0
down vote
favorite
AskTensorFlow
I have used the tensorflow packaged datasets like MNIST, IMDB to study the working of tensorflow. However, in practical applications we have to preprocess and prepare the dataset on our own. Suppose I am working with image dataset, so I want to preprocess them to a format that can be fed into a tensorflow model. How can I preprocess image dataset to a tensorflow format?
tensorflow keras conv-neural-network tensorflow-datasets
add a comment |
up vote
0
down vote
favorite
AskTensorFlow
I have used the tensorflow packaged datasets like MNIST, IMDB to study the working of tensorflow. However, in practical applications we have to preprocess and prepare the dataset on our own. Suppose I am working with image dataset, so I want to preprocess them to a format that can be fed into a tensorflow model. How can I preprocess image dataset to a tensorflow format?
tensorflow keras conv-neural-network tensorflow-datasets
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
AskTensorFlow
I have used the tensorflow packaged datasets like MNIST, IMDB to study the working of tensorflow. However, in practical applications we have to preprocess and prepare the dataset on our own. Suppose I am working with image dataset, so I want to preprocess them to a format that can be fed into a tensorflow model. How can I preprocess image dataset to a tensorflow format?
tensorflow keras conv-neural-network tensorflow-datasets
AskTensorFlow
I have used the tensorflow packaged datasets like MNIST, IMDB to study the working of tensorflow. However, in practical applications we have to preprocess and prepare the dataset on our own. Suppose I am working with image dataset, so I want to preprocess them to a format that can be fed into a tensorflow model. How can I preprocess image dataset to a tensorflow format?
tensorflow keras conv-neural-network tensorflow-datasets
tensorflow keras conv-neural-network tensorflow-datasets
asked yesterday
Anand Nautiyal
306
306
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
When working with images, you will usually use a generator.
Generator is a function which output (u,v)
, where u
are the samples, and v
are the labels.
Example on how to do this can be found here How to train TensorFlow network using a generator to produce inputs?.
When building the generator function to deal with image, remember that every image is just an array, of either (x,y)
for greyscale, or (x,y,channels)
for color image.
Thus your generator function will need to read a batch of images from the disk, and turn them into arrays. there are plenty of tools to handle this: opencv , scipy, PIL.
After loading the images you can do any manipulations you like on them (using these tools, or others), usualy you will need to reshape the image to fit your model.
In the end you will need to output a pair ([batch_size,x,y,channels], [batch_size,labels])
.
I will try this out and let you know how it turned out. Thanks
– Anand Nautiyal
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
When working with images, you will usually use a generator.
Generator is a function which output (u,v)
, where u
are the samples, and v
are the labels.
Example on how to do this can be found here How to train TensorFlow network using a generator to produce inputs?.
When building the generator function to deal with image, remember that every image is just an array, of either (x,y)
for greyscale, or (x,y,channels)
for color image.
Thus your generator function will need to read a batch of images from the disk, and turn them into arrays. there are plenty of tools to handle this: opencv , scipy, PIL.
After loading the images you can do any manipulations you like on them (using these tools, or others), usualy you will need to reshape the image to fit your model.
In the end you will need to output a pair ([batch_size,x,y,channels], [batch_size,labels])
.
I will try this out and let you know how it turned out. Thanks
– Anand Nautiyal
yesterday
add a comment |
up vote
0
down vote
When working with images, you will usually use a generator.
Generator is a function which output (u,v)
, where u
are the samples, and v
are the labels.
Example on how to do this can be found here How to train TensorFlow network using a generator to produce inputs?.
When building the generator function to deal with image, remember that every image is just an array, of either (x,y)
for greyscale, or (x,y,channels)
for color image.
Thus your generator function will need to read a batch of images from the disk, and turn them into arrays. there are plenty of tools to handle this: opencv , scipy, PIL.
After loading the images you can do any manipulations you like on them (using these tools, or others), usualy you will need to reshape the image to fit your model.
In the end you will need to output a pair ([batch_size,x,y,channels], [batch_size,labels])
.
I will try this out and let you know how it turned out. Thanks
– Anand Nautiyal
yesterday
add a comment |
up vote
0
down vote
up vote
0
down vote
When working with images, you will usually use a generator.
Generator is a function which output (u,v)
, where u
are the samples, and v
are the labels.
Example on how to do this can be found here How to train TensorFlow network using a generator to produce inputs?.
When building the generator function to deal with image, remember that every image is just an array, of either (x,y)
for greyscale, or (x,y,channels)
for color image.
Thus your generator function will need to read a batch of images from the disk, and turn them into arrays. there are plenty of tools to handle this: opencv , scipy, PIL.
After loading the images you can do any manipulations you like on them (using these tools, or others), usualy you will need to reshape the image to fit your model.
In the end you will need to output a pair ([batch_size,x,y,channels], [batch_size,labels])
.
When working with images, you will usually use a generator.
Generator is a function which output (u,v)
, where u
are the samples, and v
are the labels.
Example on how to do this can be found here How to train TensorFlow network using a generator to produce inputs?.
When building the generator function to deal with image, remember that every image is just an array, of either (x,y)
for greyscale, or (x,y,channels)
for color image.
Thus your generator function will need to read a batch of images from the disk, and turn them into arrays. there are plenty of tools to handle this: opencv , scipy, PIL.
After loading the images you can do any manipulations you like on them (using these tools, or others), usualy you will need to reshape the image to fit your model.
In the end you will need to output a pair ([batch_size,x,y,channels], [batch_size,labels])
.
answered yesterday
Or Dinari
500218
500218
I will try this out and let you know how it turned out. Thanks
– Anand Nautiyal
yesterday
add a comment |
I will try this out and let you know how it turned out. Thanks
– Anand Nautiyal
yesterday
I will try this out and let you know how it turned out. Thanks
– Anand Nautiyal
yesterday
I will try this out and let you know how it turned out. Thanks
– Anand Nautiyal
yesterday
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349245%2fpreparing-images-to-feed-into-tensorflow-as-datasets%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown