{
  "id": 300087,
  "title": "Error when running my model on the test data",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/300087",
  "author_name": "",
  "post_date": "2022-01-11T04:22:19.607716500Z",
  "votes": null,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I ran my model on the test data:<br>\n<code>yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)\nfor idx, (img, pred_df) in enumerate (tqdm(iter_test)):\n    bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,\n                           augment=validation_generator)\n    print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")\n    annot         = format_prediction(bboxes, confs)\n    print(f\"Annotation is {annot}\")\n    pred_df['annotations'] = annot\n    env.predict(pred_df)</code></p>\n<p>It threw an error:<br>\n`<br>\n0/? [00:00&lt;?, ?it/s]</p>\n<h2>You must call <code>predict()</code> successfully before you can continue with <code>iter_test()</code></h2>\n<p>TypeError                                 Traceback (most recent call last)<br>\n/tmp/ipykernel_38/1058722579.py in <br>\n      1 #yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)<br>\n----&gt; 2 for idx, (img, pred_df) in enumerate (tqdm(iter_test)):<br>\n      3     bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,<br>\n      4                            augment=validation_generator)<br>\n      5     print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")</p>\n<p>TypeError: cannot unpack non-iterable NoneType object`</p>\n<p>Would anyone know why it threw an error?</p>",
  "messages": [
    {
      "id": "1645604",
      "postDate": "01/11/2022 04:22:19",
      "content": "<p>I ran my model on the test data:<br>\n<code>yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)\nfor idx, (img, pred_df) in enumerate (tqdm(iter_test)):\n    bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,\n                           augment=validation_generator)\n    print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")\n    annot         = format_prediction(bboxes, confs)\n    print(f\"Annotation is {annot}\")\n    pred_df['annotations'] = annot\n    env.predict(pred_df)</code></p>\n<p>It threw an error:<br>\n`<br>\n0/? [00:00&lt;?, ?it/s]</p>\n<h2>You must call <code>predict()</code> successfully before you can continue with <code>iter_test()</code></h2>\n<p>TypeError                                 Traceback (most recent call last)<br>\n/tmp/ipykernel_38/1058722579.py in <br>\n      1 #yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)<br>\n----&gt; 2 for idx, (img, pred_df) in enumerate (tqdm(iter_test)):<br>\n      3     bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,<br>\n      4                            augment=validation_generator)<br>\n      5     print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")</p>\n<p>TypeError: cannot unpack non-iterable NoneType object`</p>\n<p>Would anyone know why it threw an error?</p>",
      "rawMarkdown": "I ran my model on the test data:\n`yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)\nfor idx, (img, pred_df) in enumerate (tqdm(iter_test)):\n    bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,\n                           augment=validation_generator)\n    print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")\n    annot         = format_prediction(bboxes, confs)\n    print(f\"Annotation is {annot}\")\n    pred_df['annotations'] = annot\n    env.predict(pred_df)`\n\nIt threw an error:\n`\n0/? [00:00<?, ?it/s]\nYou must call `predict()` successfully before you can continue with `iter_test()`\n---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n/tmp/ipykernel_38/1058722579.py in <module>\n      1 #yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)\n----> 2 for idx, (img, pred_df) in enumerate (tqdm(iter_test)):\n      3     bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,\n      4                            augment=validation_generator)\n      5     print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")\n\nTypeError: cannot unpack non-iterable NoneType object`\n\nWould anyone know why it threw an error?",
      "votes": null
    },
    {
      "id": "1645727",
      "postDate": "01/11/2022 07:08:27",
      "content": "<p><a href=\"https://www.kaggle.com/anhnguyen811\" target=\"_blank\">@anhnguyen811</a> You run notebook on Kaggle API. This is normal.<br>\nIf you run it one time and then again it will produce error. Kaggle API is only for submission.</p>",
      "rawMarkdown": "anhnguyen811 You run notebook on Kaggle API. This is normal.\nIf you run it one time and then again it will produce error. Kaggle API is only for submission.",
      "votes": null
    },
    {
      "id": "1650248",
      "postDate": "01/14/2022 23:39:43",
      "content": "<p><a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>, dziękuję. I appreciate your response. I only run the Kaggle API once, and it works. </p>",
      "rawMarkdown": "remekkinas, dziękuję. I appreciate your response. I only run the Kaggle API once, and it works.",
      "votes": null
    },
    {
      "id": "1650259",
      "postDate": "01/14/2022 23:44:50",
      "content": "<p><a href=\"https://www.kaggle.com/anhnguyen811\" target=\"_blank\">@anhnguyen811</a> you are welcome (\"cała przyjemność po mojej stronie\") :) <br>\nYes, this part is only for submission. You can reload submission API just by using </p>\n<pre><code>env = greatbarrierreef.make_env()\niter_test = env.iter_test()\n</code></pre>\n<p>and then you can enumerate over images again. </p>",
      "rawMarkdown": "anhnguyen811 you are welcome (\"cała przyjemność po mojej stronie\") :) \nYes, this part is only for submission. You can reload submission API just by using \n\n```python\nenv = greatbarrierreef.make_env()\niter_test = env.iter_test()\n```\n\nand then you can enumerate over images again.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1645727,
      "author_name": "remekkinas",
      "author_url": "",
      "post_date": "01/11/2022 07:08:27",
      "content": "<p><a href=\"https://www.kaggle.com/anhnguyen811\" target=\"_blank\">@anhnguyen811</a> You run notebook on Kaggle API. This is normal.<br>\nIf you run it one time and then again it will produce error. Kaggle API is only for submission.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1650248,
          "author_name": "anhnguyen811",
          "author_url": "",
          "post_date": "01/14/2022 23:39:43",
          "content": "<p><a href=\"https://www.kaggle.com/remekkinas\" target=\"_blank\">@remekkinas</a>, dziękuję. I appreciate your response. I only run the Kaggle API once, and it works. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1650259,
          "author_name": "remekkinas",
          "author_url": "",
          "post_date": "01/14/2022 23:44:50",
          "content": "<p><a href=\"https://www.kaggle.com/anhnguyen811\" target=\"_blank\">@anhnguyen811</a> you are welcome (\"cała przyjemność po mojej stronie\") :) <br>\nYes, this part is only for submission. You can reload submission API just by using </p>\n<pre><code>env = greatbarrierreef.make_env()\niter_test = env.iter_test()\n</code></pre>\n<p>and then you can enumerate over images again. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1645604": "I ran my model on the test data:\n`yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)\nfor idx, (img, pred_df) in enumerate (tqdm(iter_test)):\n    bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,\n                           augment=validation_generator)\n    print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")\n    annot         = format_prediction(bboxes, confs)\n    print(f\"Annotation is {annot}\")\n    pred_df['annotations'] = annot\n    env.predict(pred_df)`\n\nIt threw an error:\n`\n0/? [00:00<?, ?it/s]\nYou must call `predict()` successfully before you can continue with `iter_test()`\n---------------------------------------------------------------------------\nTypeError                                 Traceback (most recent call last)\n/tmp/ipykernel_38/1058722579.py in <module>\n      1 #yolov5_model=load_model(CKPT_PATH, conf=CONF, iou = IOU)\n----> 2 for idx, (img, pred_df) in enumerate (tqdm(iter_test)):\n      3     bboxes, confs = predict(yolov5_model, img, size = IMG_SIZE,\n      4                            augment=validation_generator)\n      5     print(f\"Image[{idx}] produced {len(bboxes)} bboxes w. max conf {max(confs)}\")\n\nTypeError: cannot unpack non-iterable NoneType object`\n\nWould anyone know why it threw an error?",
    "1645727": "anhnguyen811 You run notebook on Kaggle API. This is normal.\nIf you run it one time and then again it will produce error. Kaggle API is only for submission.",
    "1650248": "remekkinas, dziękuję. I appreciate your response. I only run the Kaggle API once, and it works.",
    "1650259": "anhnguyen811 you are welcome (\"cała przyjemność po mojej stronie\") :) \nYes, this part is only for submission. You can reload submission API just by using \n\n```python\nenv = greatbarrierreef.make_env()\niter_test = env.iter_test()\n```\n\nand then you can enumerate over images again."
  },
  "source": "meta"
}