{
  "id": 166870,
  "title": "Model fitting with Map datasets ",
  "url": "/competitions/siim-isic-melanoma-classification/discussion/166870",
  "author_name": "Prince Chaturvedi",
  "post_date": "2020-07-14T10:29:17.181000",
  "votes": 0,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hello all</p>\n\n<p>Need advice in fixing below issue:</p>\n\n<p>Model architecture </p>\n\n<p>model = Sequential()\nmodel.add(Conv2D(input_shape=(1024,1024,3),filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(Conv2D(filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))\nmodel.add(Flatten())\nmodel.add(Dense(units=128,activation=\"relu\"))\nmodel.add(Dense(units=2, activation=\"softmax\"))\nmodel.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])</p>\n\n<p>Dataset: \nMapDataset shapes: ((1024, 1024, 3), ()), types: (tf.float32, tf.int64)</p>\n\n<p>I am fitting with model with below command:\nmodel.fit(dataset,epochs = 5)</p>\n\n<p>But in this step i am getting this error : \nValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1024, 1024, 3)</p>",
  "messages": [
    {
      "id": 928927,
      "postDate": "2020-07-14T10:29:17.180Z",
      "content": "<p>Hello all</p>\n\n<p>Need advice in fixing below issue:</p>\n\n<p>Model architecture </p>\n\n<p>model = Sequential()\nmodel.add(Conv2D(input_shape=(1024,1024,3),filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(Conv2D(filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))\nmodel.add(Flatten())\nmodel.add(Dense(units=128,activation=\"relu\"))\nmodel.add(Dense(units=2, activation=\"softmax\"))\nmodel.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])</p>\n\n<p>Dataset: \nMapDataset shapes: ((1024, 1024, 3), ()), types: (tf.float32, tf.int64)</p>\n\n<p>I am fitting with model with below command:\nmodel.fit(dataset,epochs = 5)</p>\n\n<p>But in this step i am getting this error : \nValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1024, 1024, 3)</p>",
      "rawMarkdown": "Hello all\n\nNeed advice in fixing below issue:\n\nModel architecture \n\nmodel = Sequential()\nmodel.add(Conv2D(input_shape=(1024,1024,3),filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(Conv2D(filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))\nmodel.add(Flatten())\nmodel.add(Dense(units=128,activation=\"relu\"))\nmodel.add(Dense(units=2, activation=\"softmax\"))\nmodel.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])\n\nDataset: \nMapDataset shapes: ((1024, 1024, 3), ()), types: (tf.float32, tf.int64)\n\nI am fitting with model with below command:\nmodel.fit(dataset,epochs = 5)\n\nBut in this step i am getting this error : \nValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1024, 1024, 3)\n\n\n\n"
    },
    {
      "id": 929038,
      "postDate": "2020-07-14T12:14:09.837Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 929054,
          "postDate": "2020-07-14T12:31:28.610Z",
          "content": "<p>MapDataset --it does not have reshape function</p>",
          "rawMarkdown": "MapDataset --it does not have reshape function"
        },
        {
          "id": 929068,
          "postDate": "2020-07-14T12:48:47.420Z",
          "content": "<p>Use dataset.repeat().This will fit upto your batch size</p>",
          "rawMarkdown": "Use dataset.repeat().This will fit upto your batch size"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 929038,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-07-14T12:14:09.837000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 929054,
          "author_name": "Prince Chaturvedi",
          "author_url": "",
          "post_date": "2020-07-14T12:31:28.610000",
          "content": "<p>MapDataset --it does not have reshape function</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 929068,
          "author_name": "MhdSharuk",
          "author_url": "",
          "post_date": "2020-07-14T12:48:47.420000",
          "content": "<p>Use dataset.repeat().This will fit upto your batch size</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "928927": "Hello all\n\nNeed advice in fixing below issue:\n\nModel architecture \n\nmodel = Sequential()\nmodel.add(Conv2D(input_shape=(1024,1024,3),filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(Conv2D(filters=64,kernel_size=(3,3),padding=\"same\", activation=\"relu\"))\nmodel.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))\nmodel.add(Flatten())\nmodel.add(Dense(units=128,activation=\"relu\"))\nmodel.add(Dense(units=2, activation=\"softmax\"))\nmodel.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])\n\nDataset: \nMapDataset shapes: ((1024, 1024, 3), ()), types: (tf.float32, tf.int64)\n\nI am fitting with model with below command:\nmodel.fit(dataset,epochs = 5)\n\nBut in this step i am getting this error : \nValueError: Error when checking input: expected conv2d_input to have 4 dimensions, but got array with shape (1024, 1024, 3)\n\n\n\n",
    "929038": ""
  }
}