{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/3946","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/3946/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/3946/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/3946/events","html_url":"https://github.com/fchollet/keras/issues/3946","id":180624772,"number":3946,"title":"flow_from_directory seems to find no images","user":{"login":"cdalbergue","id":11771656,"avatar_url":"https://avatars.githubusercontent.com/u/11771656?v=3","gravatar_id":"","url":"https://api.github.com/users/cdalbergue","html_url":"https://github.com/cdalbergue","followers_url":"https://api.github.com/users/cdalbergue/followers","following_url":"https://api.github.com/users/cdalbergue/following{/other_user}","gists_url":"https://api.github.com/users/cdalbergue/gists{/gist_id}","starred_url":"https://api.github.com/users/cdalbergue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdalbergue/subscriptions","organizations_url":"https://api.github.com/users/cdalbergue/orgs","repos_url":"https://api.github.com/users/cdalbergue/repos","events_url":"https://api.github.com/users/cdalbergue/events{/privacy}","received_events_url":"https://api.github.com/users/cdalbergue/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-03T12:09:12Z","updated_at":"2016-11-12T23:13:53Z","closed_at":"2016-10-03T13:00:01Z","body":"# Hello\n\nI'm running into this issue using the latest version of Keras (1.1.0). I also tried to use version 1.0.0 and 1.0.1 and it's the same.\n\nWhenever I try to use the data augmentation ImageDataGenerator, it seems that the method flow_from_directory can't find any image in my folders.\n\nHere's my model code:\n\n``` python\nimg_width, img_height = 150, 150\n\ntrain_data_dir = 'data/train'\nvalidation_data_dir = 'data/validation'\nnb_train_samples = 2000\nnb_validation_samples = 800\nnb_epoch = 5\n\n\nmodel = Sequential()\nmodel.add(Convolution2D(32, 3, 3, input_shape=(3, img_width, img_height,)))\nmodel.add(Activation('relu'))\nmodel.add(MaxPooling2D(pool_size=(2, 2), dim_ordering=\"th\"))\n\nmodel.add(Convolution2D(32, 3, 3, dim_ordering=\"th\"))\nmodel.add(Activation('relu'))\nmodel.add(MaxPooling2D(pool_size=(2, 2)))\n\nmodel.add(Convolution2D(64, 3, 3))\nmodel.add(Activation('relu'))\nmodel.add(MaxPooling2D(pool_size=(2, 2)))\n\nmodel.add(Flatten())\nmodel.add(Dense(64))\nmodel.add(Activation('relu'))\nmodel.add(Dropout(1))\nmodel.add(Dense(1))\nmodel.add(Activation('sigmoid'))\n```\n\nHere's my data augmentation code: **(error is located here)**\n\n``` python\ntrain_datagen = ImageDataGenerator(\n        rescale=1./255,\n        shear_range=0.2,\n        zoom_range=0.2,\n        horizontal_flip=True)\n\ntest_datagen = ImageDataGenerator(rescale=1./255)\n\ntrain_generator = train_datagen.flow_from_directory(\n        'data/train',\n        target_size=(150, 150),\n        batch_size=32,\n        class_mode='binary')\n\nvalidation_generator = test_datagen.flow_from_directory(\n        'data/validation',\n        target_size=(150, 150),\n        batch_size=32,\n        class_mode='binary')\n\nmodel.fit_generator(\n        train_generator,\n        samples_per_epoch=2000,\n        nb_epoch=50,\n        validation_data=validation_generator,\n        nb_val_samples=800)\n```\n\nI followed this tutorial (even corrected some mistakes with the dimension ordering)\nhttps://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html\n\nAfter solving a lot of errors, I'm stuck to the point where the method flow_ffrom_directory finds no image in my folders, thus generating a null output:\n\n```\n$ python ml.py\nUsing TensorFlow backend.\nFound 0 images belonging to 0 classes.\nFound 0 images belonging to 0 classes.\nEpoch 1/5\nTraceback (most recent call last):\n  File \"ml.py\", line 69, in <module>\n    nb_val_samples=nb_validation_samples)\n  File \"/home/clement/ESIEA/5A/Machine_Learning/lib/python3.5/site-packages/Keras-1.1.0-py3.5.egg/keras/models.py\", line 874, in fit_generator\n    pickle_safe=pickle_safe)\n  File \"/home/clement/ESIEA/5A/Machine_Learning/lib/python3.5/site-packages/Keras-1.1.0-py3.5.egg/keras/engine/training.py\", line 1417, in fit_generator\n    'or (x, y). Found: ' + str(generator_output))\nException: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None\n```\n\nI even tried to modify the number of images in my folder but there seems to be nothing I could do.\n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/260154895","html_url":"https://github.com/fchollet/keras/issues/3946#issuecomment-260154895","issue_url":"https://api.github.com/repos/fchollet/keras/issues/3946","id":260154895,"user":{"login":"zahrasorour","id":23213469,"avatar_url":"https://avatars.githubusercontent.com/u/23213469?v=3","gravatar_id":"","url":"https://api.github.com/users/zahrasorour","html_url":"https://github.com/zahrasorour","followers_url":"https://api.github.com/users/zahrasorour/followers","following_url":"https://api.github.com/users/zahrasorour/following{/other_user}","gists_url":"https://api.github.com/users/zahrasorour/gists{/gist_id}","starred_url":"https://api.github.com/users/zahrasorour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zahrasorour/subscriptions","organizations_url":"https://api.github.com/users/zahrasorour/orgs","repos_url":"https://api.github.com/users/zahrasorour/repos","events_url":"https://api.github.com/users/zahrasorour/events{/privacy}","received_events_url":"https://api.github.com/users/zahrasorour/received_events","type":"User","site_admin":false},"created_at":"2016-11-12T23:13:53Z","updated_at":"2016-11-12T23:13:53Z","body":"I have it in a folder that contains folders of pictures. Still, it doesn't read my image. Why is that?"}}
{"actor":{"display_login":"zahrasorour"}}