{
  "id": 167663,
  "title": "Training ETA is 5 hours when I added step_per_epoch  with epoch=1",
  "url": "/competitions/siim-isic-melanoma-classification/discussion/167663",
  "author_name": "",
  "post_date": "2020-07-17T12:34:44.384512800Z",
  "votes": 2,
  "comment_count": 3,
  "views": 0,
  "content": "<p>train_data_generator = image_generator.flow_from_dataframe(train_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\nvalid_data_generator  = image_generator.flow_from_dataframe(val_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\n    class_weights = class_weight.compute_class_weight('balanced',np.unique(train_data_generator.labels),train_data_generator.labels)</p>\n\n<h1>create model</h1>\n\n<pre><code>model=get_model()\n</code></pre>\n\n<h1>Compile the model</h1>\n\n<pre><code>model.compile(loss='binary_crossentropy',optimizer ='sgd',metrics=[tf.keras.metrics.AUC()])\n# CREATE CALLBACKS\n\ncheckpoint = keras.callbacks.ModelCheckpoint('model_'+str(fold_var)+'.h5',monitor='val_accuracy', verbose=1,save_best_only=True, mode='max')\n\ncallbacks_list = [checkpoint]\n\nhistory = model.fit_generator(train_data_generator,validation_data=valid_data_generator,steps_per_epoch=int(math.ceil(1. * X_train.shape[0] // 25)),validation_steps=int(math.ceil(1. * X_Val.shape[0] // 25)),callbacks=callbacks_list,class_weight=class_weights,epochs =1)\n</code></pre>",
  "messages": [
    {
      "id": "933025",
      "postDate": "07/17/2020 12:34:44",
      "content": "<p>train_data_generator = image_generator.flow_from_dataframe(train_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\nvalid_data_generator  = image_generator.flow_from_dataframe(val_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\n    class_weights = class_weight.compute_class_weight('balanced',np.unique(train_data_generator.labels),train_data_generator.labels)</p>\n\n<h1>create model</h1>\n\n<pre><code>model=get_model()\n</code></pre>\n\n<h1>Compile the model</h1>\n\n<pre><code>model.compile(loss='binary_crossentropy',optimizer ='sgd',metrics=[tf.keras.metrics.AUC()])\n# CREATE CALLBACKS\n\ncheckpoint = keras.callbacks.ModelCheckpoint('model_'+str(fold_var)+'.h5',monitor='val_accuracy', verbose=1,save_best_only=True, mode='max')\n\ncallbacks_list = [checkpoint]\n\nhistory = model.fit_generator(train_data_generator,validation_data=valid_data_generator,steps_per_epoch=int(math.ceil(1. * X_train.shape[0] // 25)),validation_steps=int(math.ceil(1. * X_Val.shape[0] // 25)),callbacks=callbacks_list,class_weight=class_weights,epochs =1)\n</code></pre>",
      "rawMarkdown": "train_data_generator = image_generator.flow_from_dataframe(train_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\nvalid_data_generator  = image_generator.flow_from_dataframe(val_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\n    class_weights = class_weight.compute_class_weight('balanced',np.unique(train_data_generator.labels),train_data_generator.labels)\n# create model \n    model=get_model()\n\n# Compile the model\n    model.compile(loss='binary_crossentropy',optimizer ='sgd',metrics=[tf.keras.metrics.AUC()])\n    # CREATE CALLBACKS\n\t\n    checkpoint = keras.callbacks.ModelCheckpoint('model_'+str(fold_var)+'.h5',monitor='val_accuracy', verbose=1,save_best_only=True, mode='max')\n    \n    callbacks_list = [checkpoint]\n    \n    history = model.fit_generator(train_data_generator,validation_data=valid_data_generator,steps_per_epoch=int(math.ceil(1. * X_train.shape[0] // 25)),validation_steps=int(math.ceil(1. * X_Val.shape[0] // 25)),callbacks=callbacks_list,class_weight=class_weights,epochs =1)",
      "votes": null
    },
    {
      "id": "934754",
      "postDate": "07/18/2020 17:35:21",
      "content": "<p><a href=\"/mohitranjan18\">@mohitranjan18</a> you can try <a href=\"https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet\">this training</a> pipelines, by this you can utilize kernel GPU max.</p>",
      "rawMarkdown": "mohitranjan18 you can try [this training](https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet) pipelines, by this you can utilize kernel GPU max.",
      "votes": null
    },
    {
      "id": "936560",
      "postDate": "07/20/2020 10:12:33",
      "content": "<p>Are you running the kernel with a GPU?</p>",
      "rawMarkdown": "Are you running the kernel with a GPU?",
      "votes": null
    },
    {
      "id": "937185",
      "postDate": "07/20/2020 19:36:12",
      "content": "<p>I am using GPU</p>",
      "rawMarkdown": "I am using GPU",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 934754,
      "author_name": "ipythonx",
      "author_url": "",
      "post_date": "07/18/2020 17:35:21",
      "content": "<p><a href=\"/mohitranjan18\">@mohitranjan18</a> you can try <a href=\"https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet\">this training</a> pipelines, by this you can utilize kernel GPU max.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 936560,
      "author_name": "amneves",
      "author_url": "",
      "post_date": "07/20/2020 10:12:33",
      "content": "<p>Are you running the kernel with a GPU?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 937185,
      "author_name": "mohitranjan18",
      "author_url": "",
      "post_date": "07/20/2020 19:36:12",
      "content": "<p>I am using GPU</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "933025": "train_data_generator = image_generator.flow_from_dataframe(train_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\nvalid_data_generator  = image_generator.flow_from_dataframe(val_df, directory = IMAGE_DIR,x_col = \"image_name\", y_col = \"target\",class_mode = \"raw\", batch_size=25, target_size=(240,240),shuffle = True)\n    class_weights = class_weight.compute_class_weight('balanced',np.unique(train_data_generator.labels),train_data_generator.labels)\n# create model \n    model=get_model()\n\n# Compile the model\n    model.compile(loss='binary_crossentropy',optimizer ='sgd',metrics=[tf.keras.metrics.AUC()])\n    # CREATE CALLBACKS\n\t\n    checkpoint = keras.callbacks.ModelCheckpoint('model_'+str(fold_var)+'.h5',monitor='val_accuracy', verbose=1,save_best_only=True, mode='max')\n    \n    callbacks_list = [checkpoint]\n    \n    history = model.fit_generator(train_data_generator,validation_data=valid_data_generator,steps_per_epoch=int(math.ceil(1. * X_train.shape[0] // 25)),validation_steps=int(math.ceil(1. * X_Val.shape[0] // 25)),callbacks=callbacks_list,class_weight=class_weights,epochs =1)",
    "934754": "mohitranjan18 you can try [this training](https://www.kaggle.com/ipythonx/tf-keras-melanoma-classification-starter-tabnet) pipelines, by this you can utilize kernel GPU max.",
    "936560": "Are you running the kernel with a GPU?",
    "937185": "I am using GPU"
  },
  "source": "meta"
}