{"action":"created","issue":{"url":"https://api.github.com/repos/tflearn/tflearn/issues/319","repository_url":"https://api.github.com/repos/tflearn/tflearn","labels_url":"https://api.github.com/repos/tflearn/tflearn/issues/319/labels{/name}","comments_url":"https://api.github.com/repos/tflearn/tflearn/issues/319/comments","events_url":"https://api.github.com/repos/tflearn/tflearn/issues/319/events","html_url":"https://github.com/tflearn/tflearn/issues/319","id":174294633,"number":319,"title":"when I use the image_preloader, I met a bug \"could not broadcast input array from shape (224,224,3) into shape (224,224)\"","user":{"login":"burness","id":3112825,"avatar_url":"https://avatars.githubusercontent.com/u/3112825?v=3","gravatar_id":"","url":"https://api.github.com/users/burness","html_url":"https://github.com/burness","followers_url":"https://api.github.com/users/burness/followers","following_url":"https://api.github.com/users/burness/following{/other_user}","gists_url":"https://api.github.com/users/burness/gists{/gist_id}","starred_url":"https://api.github.com/users/burness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burness/subscriptions","organizations_url":"https://api.github.com/users/burness/orgs","repos_url":"https://api.github.com/users/burness/repos","events_url":"https://api.github.com/users/burness/events{/privacy}","received_events_url":"https://api.github.com/users/burness/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-31T14:52:22Z","updated_at":"2016-08-31T19:40:20Z","closed_at":null,"body":"The code is here:\r\n\r\n```\r\n# -*- coding: utf-8 -*-\r\nfrom __future__ import division, print_function, absolute_import\r\n'''\r\nCoding Just for Fun\r\nCreated by burness on 16/8/30.\r\n'''\r\n\r\n\r\nimport tflearn\r\nfrom tflearn.layers.estimator import regression\r\nfrom tflearn.data_utils import build_image_dataset_from_dir\r\nimport os\r\nfrom config import  *\r\n\r\ndef vgg16(placeholderX=None):\r\n    x = tflearn.input_data(shape=[None, 224, 224, 3], name='input',\r\n                           placeholder=placeholderX)\r\n    x = tflearn.conv_2d(x, 64, 3, activation='relu', scope='conv1_1')\r\n    x = tflearn.conv_2d(x, 64, 3, activation='relu', scope='conv1_2')\r\n    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool1')\r\n\r\n    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_1')\r\n    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_2')\r\n    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool2')\r\n\r\n    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_1')\r\n    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_2')\r\n    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_3')\r\n    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool3')\r\n\r\n    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_1')\r\n    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_2')\r\n    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_3')\r\n    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool4')\r\n\r\n    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_1')\r\n    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_2')\r\n    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_3')\r\n    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool5')\r\n\r\n    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc6')\r\n    x = tflearn.dropout(x, 0.5, name='dropout1')\r\n\r\n    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc7')\r\n    x = tflearn.dropout(x, 0.5, name='dropout2')\r\n\r\n    x = tflearn.fully_connected(x, 12, activation='softmax', scope='fc8',restore=False)\r\n\r\n    return x\r\ndata_dir = data_path\r\nfrom tflearn.data_utils import image_preloader\r\nX,Y = image_preloader('files_list', image_shape = (224,224),mode='file',categorical_labels=True,normalize=True)\r\n\r\n# data_dir = data_path\r\n# dataset_file = os.path.join(data_dir, 'DL_bot.pkl')\r\n# shuffle = False\r\n# one_hot = True\r\n# resize_pics = (224,224)\r\n# X, Y = build_image_dataset_from_dir(data_dir,\r\n#                                     dataset_file=dataset_file,\r\n#                                     resize=resize_pics,\r\n#                                     filetypes=['.jpg', '.jpeg'],\r\n#                                     convert_gray=False,\r\n#                                     shuffle_data=shuffle,\r\n#                                     categorical_Y=one_hot)\r\n\r\nnum_classes = 12\r\n\r\nsoftmax = vgg16()\r\nregression = regression(softmax, optimizer='adam',\r\n                        loss='categorical_crossentropy',\r\n                        learning_rate=0.001,restore=False)\r\n\r\nmodel = tflearn.DNN(regression, checkpoint_path='finetuning-cv',\r\n                    max_checkpoints=3, tensorboard_verbose=2, tensorboard_dir=\"./logs\")\r\n\r\n\r\n\r\nmodel_file = os.path.join(model_path, \"vgg16.tflearn\")\r\nmodel.load(model_file,weights_only=True)\r\n\r\n# Start finetuning\r\nmodel.fit(X, Y, n_epoch=10, validation_set=0.1, shuffle=True,\r\n          show_metric=True, batch_size=64, snapshot_epoch=False, snapshot_step=200, run_id='finetuning')\r\n\r\nmodel.save('animal-classifier')\r\nmodel.predict()\r\n```\r\n\r\n\r\nI use the data input method with the comment, it is ok to run, but when i change to image_preloader,  it met an error with `ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)`\r\n\r\nPlease check it, Thanks!!!"},"comment":{"url":"https://api.github.com/repos/tflearn/tflearn/issues/comments/243877112","html_url":"https://github.com/tflearn/tflearn/issues/319#issuecomment-243877112","issue_url":"https://api.github.com/repos/tflearn/tflearn/issues/319","id":243877112,"user":{"login":"aymericdamien","id":10386605,"avatar_url":"https://avatars.githubusercontent.com/u/10386605?v=3","gravatar_id":"","url":"https://api.github.com/users/aymericdamien","html_url":"https://github.com/aymericdamien","followers_url":"https://api.github.com/users/aymericdamien/followers","following_url":"https://api.github.com/users/aymericdamien/following{/other_user}","gists_url":"https://api.github.com/users/aymericdamien/gists{/gist_id}","starred_url":"https://api.github.com/users/aymericdamien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aymericdamien/subscriptions","organizations_url":"https://api.github.com/users/aymericdamien/orgs","repos_url":"https://api.github.com/users/aymericdamien/repos","events_url":"https://api.github.com/users/aymericdamien/events{/privacy}","received_events_url":"https://api.github.com/users/aymericdamien/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T19:40:20Z","updated_at":"2016-08-31T19:40:20Z","body":"Could you tell where is that error happening? The error trace stack."}}
{"actor":{"display_login":"aymericdamien"}}