{
  "id": 101246,
  "title": "How to solve Evaluation Exception",
  "url": "/competitions/generative-dog-images/discussion/101246",
  "author_name": "",
  "post_date": "2019-07-24T10:24:39.998547600Z",
  "votes": null,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I have submitted my results for evaluations 2 times but both times it gave <code>Evaluation Error: The Evaluation Kernel encountered an unexpected error</code>. How can I solve this, what might I be doing wrong? This is my first time participating in a Kernel competition. Any help is appreciated. My model generates images of size 64X64 and below is the code that I use for creating <code>images.zip</code> file.\n```\nif not os.path.exists('../output_images'):\n    os.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\n    z = np.random.normal(0, 1, (im_batch_size, 512))\n    gen_imgs = generator.predict(z)\n    gen_imgs = 0.5 * gen_imgs + 0.5\n    for i_image in range(gen_imgs.shape[0]):\n        matplotlib.image.imsave(os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'), gen_imgs[i_image])</p>\n\n<p>import shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```</p>",
  "messages": [
    {
      "id": "583313",
      "postDate": "07/24/2019 10:24:40",
      "content": "<p>I have submitted my results for evaluations 2 times but both times it gave <code>Evaluation Error: The Evaluation Kernel encountered an unexpected error</code>. How can I solve this, what might I be doing wrong? This is my first time participating in a Kernel competition. Any help is appreciated. My model generates images of size 64X64 and below is the code that I use for creating <code>images.zip</code> file.\n```\nif not os.path.exists('../output_images'):\n    os.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\n    z = np.random.normal(0, 1, (im_batch_size, 512))\n    gen_imgs = generator.predict(z)\n    gen_imgs = 0.5 * gen_imgs + 0.5\n    for i_image in range(gen_imgs.shape[0]):\n        matplotlib.image.imsave(os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'), gen_imgs[i_image])</p>\n\n<p>import shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```</p>",
      "rawMarkdown": "I have submitted my results for evaluations 2 times but both times it gave `Evaluation Error: The Evaluation Kernel encountered an unexpected error`. How can I solve this, what might I be doing wrong? This is my first time participating in a Kernel competition. Any help is appreciated. My model generates images of size 64X64 and below is the code that I use for creating `images.zip` file.\n```\nif not os.path.exists('../output_images'):\n    os.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\n    z = np.random.normal(0, 1, (im_batch_size, 512))\n    gen_imgs = generator.predict(z)\n    gen_imgs = 0.5 * gen_imgs + 0.5\n    for i_image in range(gen_imgs.shape[0]):\n        matplotlib.image.imsave(os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'), gen_imgs[i_image])\n\nimport shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```",
      "votes": null
    },
    {
      "id": "583334",
      "postDate": "07/24/2019 10:52:03",
      "content": "<p>Please check your kernel execution time. This error might appear if your code failed to meet the time limit.</p>",
      "rawMarkdown": "Please check your kernel execution time. This error might appear if your code failed to meet the time limit.",
      "votes": null
    },
    {
      "id": "583360",
      "postDate": "07/24/2019 11:43:03",
      "content": "<p>My kernel runs completely in about 2 hours, and also does not exceed the memory limit, anything else that might be causing the problem?</p>",
      "rawMarkdown": "My kernel runs completely in about 2 hours, and also does not exceed the memory limit, anything else that might be causing the problem?",
      "votes": null
    },
    {
      "id": "583403",
      "postDate": "07/24/2019 12:45:01",
      "content": "<p>There are few things you can do : \n1. use the below kernel and validate MFiD locally .Since it uses external data , you wont be able to submit that kernel but you will know if there are problem .\n<a href=\"https://www.kaggle.com/wendykan/demo-mifid-metric-for-dog-image-generation-comp\">https://www.kaggle.com/wendykan/demo-mifid-metric-for-dog-image-generation-comp</a></p>\n\n<ol>\n<li>Validate you are indeed generating images in 64*64 format .</li>\n<li>Validate if you are indeed generating 10000 images (this does not look to be a problem here , at first)</li>\n<li>Copy the starter code TOTO and just modify your noise vector and predict function . Like i did below\n```\nif not os.path.exists('../output_images'):\nos.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\nz = truncated_normal((im_batch_size, 100, 1, 1), threshold=1)\ngen_z = torch.from_numpy(z).float().to(device) <br>\n#gen_z = torch.randn(im_batch_size, 100, 1, 1, device=device)\ngen_images = netG(gen_z)\nimages = gen_images.to(\"cpu\").clone().detach()\nimages = images.numpy().transpose(0, 2, 3, 1)\nfor i_image in range(gen_images.size(0)):\n    save_image((gen_images[i_image, :, :, :] +1.0)/2.0, os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'))</li>\n</ol>\n\n<p>import shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```</p>",
      "rawMarkdown": "There are few things you can do : \n1. use the below kernel and validate MFiD locally .Since it uses external data , you wont be able to submit that kernel but you will know if there are problem .\nhttps://www.kaggle.com/wendykan/demo-mifid-metric-for-dog-image-generation-comp\n\n2. Validate you are indeed generating images in 64*64 format .\n3. Validate if you are indeed generating 10000 images (this does not look to be a problem here , at first)\n4. Copy the starter code TOTO and just modify your noise vector and predict function . Like i did below\n```\nif not os.path.exists('../output_images'):\n    os.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\n    z = truncated_normal((im_batch_size, 100, 1, 1), threshold=1)\n    gen_z = torch.from_numpy(z).float().to(device)    \n    #gen_z = torch.randn(im_batch_size, 100, 1, 1, device=device)\n    gen_images = netG(gen_z)\n    images = gen_images.to(\"cpu\").clone().detach()\n    images = images.numpy().transpose(0, 2, 3, 1)\n    for i_image in range(gen_images.size(0)):\n        save_image((gen_images[i_image, :, :, :] +1.0)/2.0, os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'))\n\n\nimport shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```",
      "votes": null
    },
    {
      "id": "583936",
      "postDate": "07/25/2019 07:57:24",
      "content": "<p>Thanks everyone for your suggestions, but the problem was when I was saving image using <code>matplotlib</code> it was saving image with shape <code>(64X64X4)</code> but we need to save the images with only 3 channels so I used <code>imageio</code> and it worked.</p>",
      "rawMarkdown": "Thanks everyone for your suggestions, but the problem was when I was saving image using `matplotlib` it was saving image with shape `(64X64X4)` but we need to save the images with only 3 channels so I used `imageio` and it worked.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 583334,
      "author_name": "elroyz",
      "author_url": "",
      "post_date": "07/24/2019 10:52:03",
      "content": "<p>Please check your kernel execution time. This error might appear if your code failed to meet the time limit.</p>",
      "votes": null,
      "replies": [
        {
          "id": 583360,
          "author_name": "techytushar",
          "author_url": "",
          "post_date": "07/24/2019 11:43:03",
          "content": "<p>My kernel runs completely in about 2 hours, and also does not exceed the memory limit, anything else that might be causing the problem?</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 583403,
      "author_name": "phoenix9032",
      "author_url": "",
      "post_date": "07/24/2019 12:45:01",
      "content": "<p>There are few things you can do : \n1. use the below kernel and validate MFiD locally .Since it uses external data , you wont be able to submit that kernel but you will know if there are problem .\n<a href=\"https://www.kaggle.com/wendykan/demo-mifid-metric-for-dog-image-generation-comp\">https://www.kaggle.com/wendykan/demo-mifid-metric-for-dog-image-generation-comp</a></p>\n\n<ol>\n<li>Validate you are indeed generating images in 64*64 format .</li>\n<li>Validate if you are indeed generating 10000 images (this does not look to be a problem here , at first)</li>\n<li>Copy the starter code TOTO and just modify your noise vector and predict function . Like i did below\n```\nif not os.path.exists('../output_images'):\nos.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\nz = truncated_normal((im_batch_size, 100, 1, 1), threshold=1)\ngen_z = torch.from_numpy(z).float().to(device) <br>\n#gen_z = torch.randn(im_batch_size, 100, 1, 1, device=device)\ngen_images = netG(gen_z)\nimages = gen_images.to(\"cpu\").clone().detach()\nimages = images.numpy().transpose(0, 2, 3, 1)\nfor i_image in range(gen_images.size(0)):\n    save_image((gen_images[i_image, :, :, :] +1.0)/2.0, os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'))</li>\n</ol>\n\n<p>import shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 583936,
      "author_name": "techytushar",
      "author_url": "",
      "post_date": "07/25/2019 07:57:24",
      "content": "<p>Thanks everyone for your suggestions, but the problem was when I was saving image using <code>matplotlib</code> it was saving image with shape <code>(64X64X4)</code> but we need to save the images with only 3 channels so I used <code>imageio</code> and it worked.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "583313": "I have submitted my results for evaluations 2 times but both times it gave `Evaluation Error: The Evaluation Kernel encountered an unexpected error`. How can I solve this, what might I be doing wrong? This is my first time participating in a Kernel competition. Any help is appreciated. My model generates images of size 64X64 and below is the code that I use for creating `images.zip` file.\n```\nif not os.path.exists('../output_images'):\n    os.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\n    z = np.random.normal(0, 1, (im_batch_size, 512))\n    gen_imgs = generator.predict(z)\n    gen_imgs = 0.5 * gen_imgs + 0.5\n    for i_image in range(gen_imgs.shape[0]):\n        matplotlib.image.imsave(os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'), gen_imgs[i_image])\n\nimport shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```",
    "583334": "Please check your kernel execution time. This error might appear if your code failed to meet the time limit.",
    "583360": "My kernel runs completely in about 2 hours, and also does not exceed the memory limit, anything else that might be causing the problem?",
    "583403": "There are few things you can do : \n1. use the below kernel and validate MFiD locally .Since it uses external data , you wont be able to submit that kernel but you will know if there are problem .\nhttps://www.kaggle.com/wendykan/demo-mifid-metric-for-dog-image-generation-comp\n\n2. Validate you are indeed generating images in 64*64 format .\n3. Validate if you are indeed generating 10000 images (this does not look to be a problem here , at first)\n4. Copy the starter code TOTO and just modify your noise vector and predict function . Like i did below\n```\nif not os.path.exists('../output_images'):\n    os.mkdir('../output_images')\nim_batch_size = 50\nn_images=10000\nfor i_batch in range(0, n_images, im_batch_size):\n    z = truncated_normal((im_batch_size, 100, 1, 1), threshold=1)\n    gen_z = torch.from_numpy(z).float().to(device)    \n    #gen_z = torch.randn(im_batch_size, 100, 1, 1, device=device)\n    gen_images = netG(gen_z)\n    images = gen_images.to(\"cpu\").clone().detach()\n    images = images.numpy().transpose(0, 2, 3, 1)\n    for i_image in range(gen_images.size(0)):\n        save_image((gen_images[i_image, :, :, :] +1.0)/2.0, os.path.join('../output_images', f'image_{i_batch+i_image:05d}.png'))\n\n\nimport shutil\nshutil.make_archive('images', 'zip', '../output_images')\n```",
    "583936": "Thanks everyone for your suggestions, but the problem was when I was saving image using `matplotlib` it was saving image with shape `(64X64X4)` but we need to save the images with only 3 channels so I used `imageio` and it worked."
  },
  "source": "meta"
}