Keras ImageDataGenerator.flow_from_dataframe keeps on loading
I'm working on the MURA dataset by Stanford. I'm trying to load the dataset using Keras's ImageDataGenerator. The data is in the following hierarchy:
The study1_positive
folder contains the images.
ImageDataGenerator.flow_from_directory
cannot be used with this folder structure, therefore I tried using the flow_from_dataframe
method.
However, when run, the code keeps on executing and doesn't stop.
Following is the format of the Pandas DataFrame that I'm passing to the flow_from_directory
method:
I've also tried changing the labels to 'abnormal' and 'normal' in place of 1 and 0, respectively.
EDIT:
I've pasted the code below:
train_imggen = ImageDataGenerator(rescale=1./255, rotation_range=30,
horizontal_flip=True)
train_loader = train_imggen.flow_from_dataframe(traindf, '.', shuffle=True,
x_col='path', y_col='label',
color_mode='grayscale',
target_size=(320,320),
class_mode='binary',
batch_size=8)
python python-3.x keras dataset
add a comment |
I'm working on the MURA dataset by Stanford. I'm trying to load the dataset using Keras's ImageDataGenerator. The data is in the following hierarchy:
The study1_positive
folder contains the images.
ImageDataGenerator.flow_from_directory
cannot be used with this folder structure, therefore I tried using the flow_from_dataframe
method.
However, when run, the code keeps on executing and doesn't stop.
Following is the format of the Pandas DataFrame that I'm passing to the flow_from_directory
method:
I've also tried changing the labels to 'abnormal' and 'normal' in place of 1 and 0, respectively.
EDIT:
I've pasted the code below:
train_imggen = ImageDataGenerator(rescale=1./255, rotation_range=30,
horizontal_flip=True)
train_loader = train_imggen.flow_from_dataframe(traindf, '.', shuffle=True,
x_col='path', y_col='label',
color_mode='grayscale',
target_size=(320,320),
class_mode='binary',
batch_size=8)
python python-3.x keras dataset
Without code there is no way to help you. Please add it.
– Matias Valdenegro
Nov 20 '18 at 9:57
@MatiasValdenegro apologies! I've now added the generator code.
– UserAnon
Nov 20 '18 at 12:26
add a comment |
I'm working on the MURA dataset by Stanford. I'm trying to load the dataset using Keras's ImageDataGenerator. The data is in the following hierarchy:
The study1_positive
folder contains the images.
ImageDataGenerator.flow_from_directory
cannot be used with this folder structure, therefore I tried using the flow_from_dataframe
method.
However, when run, the code keeps on executing and doesn't stop.
Following is the format of the Pandas DataFrame that I'm passing to the flow_from_directory
method:
I've also tried changing the labels to 'abnormal' and 'normal' in place of 1 and 0, respectively.
EDIT:
I've pasted the code below:
train_imggen = ImageDataGenerator(rescale=1./255, rotation_range=30,
horizontal_flip=True)
train_loader = train_imggen.flow_from_dataframe(traindf, '.', shuffle=True,
x_col='path', y_col='label',
color_mode='grayscale',
target_size=(320,320),
class_mode='binary',
batch_size=8)
python python-3.x keras dataset
I'm working on the MURA dataset by Stanford. I'm trying to load the dataset using Keras's ImageDataGenerator. The data is in the following hierarchy:
The study1_positive
folder contains the images.
ImageDataGenerator.flow_from_directory
cannot be used with this folder structure, therefore I tried using the flow_from_dataframe
method.
However, when run, the code keeps on executing and doesn't stop.
Following is the format of the Pandas DataFrame that I'm passing to the flow_from_directory
method:
I've also tried changing the labels to 'abnormal' and 'normal' in place of 1 and 0, respectively.
EDIT:
I've pasted the code below:
train_imggen = ImageDataGenerator(rescale=1./255, rotation_range=30,
horizontal_flip=True)
train_loader = train_imggen.flow_from_dataframe(traindf, '.', shuffle=True,
x_col='path', y_col='label',
color_mode='grayscale',
target_size=(320,320),
class_mode='binary',
batch_size=8)
python python-3.x keras dataset
python python-3.x keras dataset
edited Nov 20 '18 at 12:23
UserAnon
asked Nov 20 '18 at 8:59
UserAnonUserAnon
114
114
Without code there is no way to help you. Please add it.
– Matias Valdenegro
Nov 20 '18 at 9:57
@MatiasValdenegro apologies! I've now added the generator code.
– UserAnon
Nov 20 '18 at 12:26
add a comment |
Without code there is no way to help you. Please add it.
– Matias Valdenegro
Nov 20 '18 at 9:57
@MatiasValdenegro apologies! I've now added the generator code.
– UserAnon
Nov 20 '18 at 12:26
Without code there is no way to help you. Please add it.
– Matias Valdenegro
Nov 20 '18 at 9:57
Without code there is no way to help you. Please add it.
– Matias Valdenegro
Nov 20 '18 at 9:57
@MatiasValdenegro apologies! I've now added the generator code.
– UserAnon
Nov 20 '18 at 12:26
@MatiasValdenegro apologies! I've now added the generator code.
– UserAnon
Nov 20 '18 at 12:26
add a comment |
2 Answers
2
active
oldest
votes
Found the solution here. Apparently, the current flow_from_dataframe
doesn't handle relative paths.
- Clone my "fix_found_0_images" branch.
git clone -b fix_found_0_images_bug
https://github.com/smurak/keras-preprocessing.git
- Move the "keras_preprocessing" subdirectory to your working directory.
- Import it.
import keras
from keras_preprocessing import image
...
train_imggen = image.ImageDataGenerator(...)
add a comment |
I am actually working on exact same dataset and having huge troubles... I'm now getting it to run, but it claims that "Found 0 images belonging to 2 classes."
Did you face the same problem?
Please refer to the accepted answer I posted. I was able to fix it with the mentioned steps.
– UserAnon
Nov 23 '18 at 5:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53389416%2fkeras-imagedatagenerator-flow-from-dataframe-keeps-on-loading%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Found the solution here. Apparently, the current flow_from_dataframe
doesn't handle relative paths.
- Clone my "fix_found_0_images" branch.
git clone -b fix_found_0_images_bug
https://github.com/smurak/keras-preprocessing.git
- Move the "keras_preprocessing" subdirectory to your working directory.
- Import it.
import keras
from keras_preprocessing import image
...
train_imggen = image.ImageDataGenerator(...)
add a comment |
Found the solution here. Apparently, the current flow_from_dataframe
doesn't handle relative paths.
- Clone my "fix_found_0_images" branch.
git clone -b fix_found_0_images_bug
https://github.com/smurak/keras-preprocessing.git
- Move the "keras_preprocessing" subdirectory to your working directory.
- Import it.
import keras
from keras_preprocessing import image
...
train_imggen = image.ImageDataGenerator(...)
add a comment |
Found the solution here. Apparently, the current flow_from_dataframe
doesn't handle relative paths.
- Clone my "fix_found_0_images" branch.
git clone -b fix_found_0_images_bug
https://github.com/smurak/keras-preprocessing.git
- Move the "keras_preprocessing" subdirectory to your working directory.
- Import it.
import keras
from keras_preprocessing import image
...
train_imggen = image.ImageDataGenerator(...)
Found the solution here. Apparently, the current flow_from_dataframe
doesn't handle relative paths.
- Clone my "fix_found_0_images" branch.
git clone -b fix_found_0_images_bug
https://github.com/smurak/keras-preprocessing.git
- Move the "keras_preprocessing" subdirectory to your working directory.
- Import it.
import keras
from keras_preprocessing import image
...
train_imggen = image.ImageDataGenerator(...)
answered Nov 22 '18 at 7:26
UserAnonUserAnon
114
114
add a comment |
add a comment |
I am actually working on exact same dataset and having huge troubles... I'm now getting it to run, but it claims that "Found 0 images belonging to 2 classes."
Did you face the same problem?
Please refer to the accepted answer I posted. I was able to fix it with the mentioned steps.
– UserAnon
Nov 23 '18 at 5:32
add a comment |
I am actually working on exact same dataset and having huge troubles... I'm now getting it to run, but it claims that "Found 0 images belonging to 2 classes."
Did you face the same problem?
Please refer to the accepted answer I posted. I was able to fix it with the mentioned steps.
– UserAnon
Nov 23 '18 at 5:32
add a comment |
I am actually working on exact same dataset and having huge troubles... I'm now getting it to run, but it claims that "Found 0 images belonging to 2 classes."
Did you face the same problem?
I am actually working on exact same dataset and having huge troubles... I'm now getting it to run, but it claims that "Found 0 images belonging to 2 classes."
Did you face the same problem?
answered Nov 23 '18 at 0:00
AvocadoAvocado
104
104
Please refer to the accepted answer I posted. I was able to fix it with the mentioned steps.
– UserAnon
Nov 23 '18 at 5:32
add a comment |
Please refer to the accepted answer I posted. I was able to fix it with the mentioned steps.
– UserAnon
Nov 23 '18 at 5:32
Please refer to the accepted answer I posted. I was able to fix it with the mentioned steps.
– UserAnon
Nov 23 '18 at 5:32
Please refer to the accepted answer I posted. I was able to fix it with the mentioned steps.
– UserAnon
Nov 23 '18 at 5:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f53389416%2fkeras-imagedatagenerator-flow-from-dataframe-keeps-on-loading%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
Without code there is no way to help you. Please add it.
– Matias Valdenegro
Nov 20 '18 at 9:57
@MatiasValdenegro apologies! I've now added the generator code.
– UserAnon
Nov 20 '18 at 12:26