{
  "id": 211871,
  "title": "OOM Pretrained Models",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/211871",
  "author_name": "Yuri Njathi",
  "post_date": "2021-01-16T15:56:00.491000",
  "votes": -2,
  "comment_count": 0,
  "views": 0,
  "content": "<p><a href=\"https://stackoverflow.com/questions/59394947/how-to-fix-resourceexhaustederror-oom-when-allocating-tensor\" target=\"_blank\">Link to Original</a></p>\n<p>OOM stands for \"out of memory\". Your GPU is running out of memory, so it can't allocate memory for this tensor. There are a few things you can do:</p>\n<p>Decrease the number of filters in your Dense, Conv2D layers<br>\nUse a smaller batch_size (or increase steps_per_epoch and validation_steps)<br>\nUse grayscale images (you can use tf.image.rgb_to_grayscale)<br>\nReduce the number of layers<br>\nUse MaxPooling2D layers after convolutional layers<br>\nReduce the size of your images (you can use tf.image.resize for that)<br>\nUse smaller float precision for your input, namely np.float32<br>\nIf you're using a pre-trained model, freeze the first layers (like this)<br>\nThere is more useful information about this error:</p>",
  "messages": [
    {
      "id": 1155721,
      "postDate": "2021-01-16T15:56:00.490Z",
      "content": "<p><a href=\"https://stackoverflow.com/questions/59394947/how-to-fix-resourceexhaustederror-oom-when-allocating-tensor\" target=\"_blank\">Link to Original</a></p>\n<p>OOM stands for \"out of memory\". Your GPU is running out of memory, so it can't allocate memory for this tensor. There are a few things you can do:</p>\n<p>Decrease the number of filters in your Dense, Conv2D layers<br>\nUse a smaller batch_size (or increase steps_per_epoch and validation_steps)<br>\nUse grayscale images (you can use tf.image.rgb_to_grayscale)<br>\nReduce the number of layers<br>\nUse MaxPooling2D layers after convolutional layers<br>\nReduce the size of your images (you can use tf.image.resize for that)<br>\nUse smaller float precision for your input, namely np.float32<br>\nIf you're using a pre-trained model, freeze the first layers (like this)<br>\nThere is more useful information about this error:</p>",
      "rawMarkdown": "[Link to Original](https://stackoverflow.com/questions/59394947/how-to-fix-resourceexhaustederror-oom-when-allocating-tensor)\n\nOOM stands for \"out of memory\". Your GPU is running out of memory, so it can't allocate memory for this tensor. There are a few things you can do:\n\nDecrease the number of filters in your Dense, Conv2D layers\nUse a smaller batch_size (or increase steps_per_epoch and validation_steps)\nUse grayscale images (you can use tf.image.rgb_to_grayscale)\nReduce the number of layers\nUse MaxPooling2D layers after convolutional layers\nReduce the size of your images (you can use tf.image.resize for that)\nUse smaller float precision for your input, namely np.float32\nIf you're using a pre-trained model, freeze the first layers (like this)\nThere is more useful information about this error:",
      "votes": -2
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "1155721": "[Link to Original](https://stackoverflow.com/questions/59394947/how-to-fix-resourceexhaustederror-oom-when-allocating-tensor)\n\nOOM stands for \"out of memory\". Your GPU is running out of memory, so it can't allocate memory for this tensor. There are a few things you can do:\n\nDecrease the number of filters in your Dense, Conv2D layers\nUse a smaller batch_size (or increase steps_per_epoch and validation_steps)\nUse grayscale images (you can use tf.image.rgb_to_grayscale)\nReduce the number of layers\nUse MaxPooling2D layers after convolutional layers\nReduce the size of your images (you can use tf.image.resize for that)\nUse smaller float precision for your input, namely np.float32\nIf you're using a pre-trained model, freeze the first layers (like this)\nThere is more useful information about this error:"
  }
}