{
  "id": 303567,
  "title": "Darknet and models.models not found on my notebook!!!",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/303567",
  "author_name": "",
  "post_date": "2022-01-28T08:35:50.555870700Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Since I was working on a private notebook, compromising all three YOLOs, but when I got to YOLOR and started to import all modules necessary for YOLOR inference and then, instead threw an error saying that:</p>\n<pre><code>---------------------------------------------------------------------------\nModuleNotFoundError                       Traceback (most recent call last)\n/tmp/ipykernel_37/1101678443.py in &lt;module&gt;\n      9 \n     10 # YoloR methods\n---&gt; 11 from models.models import Darknet\n     12 from utils.datasets import letterbox\n     13 from utils.general import non_max_suppression, scale_coords\n\nModuleNotFoundError: No module named 'models.models'\n</code></pre>\n<p>Here's the fragment adapted by YoloR Infer notebook, which is <a href=\"https://www.kaggle.com/remekkinas/yolor-p6-w6-one-more-yolo-on-kaggle-infer/data\" target=\"_blank\">https://www.kaggle.com/remekkinas/yolor-p6-w6-one-more-yolo-on-kaggle-infer/data</a></p>\n<pre><code>import torch\nimport cv2\n\nimport pandas as pd\nimport numpy as np\n\nfrom utils.torch_utils import select_device\nfrom PIL import Image\n\n# YoloR methods\nfrom models.models import Darknet\nfrom utils.datasets import letterbox\nfrom utils.general import non_max_suppression, scale_coords\n</code></pre>\n<p>The original notebook with YoloR only works for inference, but with my notebook, the question is, why do the weights.weights module is NOT FOUND?! Help!</p>",
  "messages": [
    {
      "id": "1667002",
      "postDate": "01/28/2022 08:35:50",
      "content": "<p>Since I was working on a private notebook, compromising all three YOLOs, but when I got to YOLOR and started to import all modules necessary for YOLOR inference and then, instead threw an error saying that:</p>\n<pre><code>---------------------------------------------------------------------------\nModuleNotFoundError                       Traceback (most recent call last)\n/tmp/ipykernel_37/1101678443.py in &lt;module&gt;\n      9 \n     10 # YoloR methods\n---&gt; 11 from models.models import Darknet\n     12 from utils.datasets import letterbox\n     13 from utils.general import non_max_suppression, scale_coords\n\nModuleNotFoundError: No module named 'models.models'\n</code></pre>\n<p>Here's the fragment adapted by YoloR Infer notebook, which is <a href=\"https://www.kaggle.com/remekkinas/yolor-p6-w6-one-more-yolo-on-kaggle-infer/data\" target=\"_blank\">https://www.kaggle.com/remekkinas/yolor-p6-w6-one-more-yolo-on-kaggle-infer/data</a></p>\n<pre><code>import torch\nimport cv2\n\nimport pandas as pd\nimport numpy as np\n\nfrom utils.torch_utils import select_device\nfrom PIL import Image\n\n# YoloR methods\nfrom models.models import Darknet\nfrom utils.datasets import letterbox\nfrom utils.general import non_max_suppression, scale_coords\n</code></pre>\n<p>The original notebook with YoloR only works for inference, but with my notebook, the question is, why do the weights.weights module is NOT FOUND?! Help!</p>",
      "rawMarkdown": "Since I was working on a private notebook, compromising all three YOLOs, but when I got to YOLOR and started to import all modules necessary for YOLOR inference and then, instead threw an error saying that:\n```\n---------------------------------------------------------------------------\nModuleNotFoundError                       Traceback (most recent call last)\n/tmp/ipykernel_37/1101678443.py in <module>\n      9 \n     10 # YoloR methods\n---> 11 from models.models import Darknet\n     12 from utils.datasets import letterbox\n     13 from utils.general import non_max_suppression, scale_coords\n\nModuleNotFoundError: No module named 'models.models'\n```\nHere's the fragment adapted by YoloR Infer notebook, which is https://www.kaggle.com/remekkinas/yolor-p6-w6-one-more-yolo-on-kaggle-infer/data\n```\nimport torch\nimport cv2\n\nimport pandas as pd\nimport numpy as np\n\nfrom utils.torch_utils import select_device\nfrom PIL import Image\n\n# YoloR methods\nfrom models.models import Darknet\nfrom utils.datasets import letterbox\nfrom utils.general import non_max_suppression, scale_coords\n```\nThe original notebook with YoloR only works for inference, but with my notebook, the question is, why do the weights.weights module is NOT FOUND?! Help!",
      "votes": null
    },
    {
      "id": "1667013",
      "postDate": "01/28/2022 08:53:06",
      "content": "<p>I had this issue,<br>\nYou installed and imported yolov5 first, So It is importing model.model from yoloV5 lib instead of yoloR lib. </p>",
      "rawMarkdown": "I had this issue,\nYou installed and imported yolov5 first, So It is importing model.model from yoloV5 lib instead of yoloR lib.",
      "votes": null
    },
    {
      "id": "1667026",
      "postDate": "01/28/2022 09:11:09",
      "content": "<p>So, how can I fix this problem?</p>",
      "rawMarkdown": "So, how can I fix this problem?",
      "votes": null
    },
    {
      "id": "1667105",
      "postDate": "01/28/2022 10:15:29",
      "content": "<p>I was stuck on this error for 2 days,<br>\nAfter a lot of debugging I found this 2 ways to solve:<br>\nMethod 1:  </p>\n<blockquote>\n  <p>Try adding the path to the system using sys.append()</p>\n</blockquote>\n<p>if it still doesn't work, then <br>\nMethod 2: </p>\n<blockquote>\n  <p>you need to add all classes and methods in the notebook.</p>\n</blockquote>",
      "rawMarkdown": "I was stuck on this error for 2 days,\nAfter a lot of debugging I found this 2 ways to solve:\nMethod 1:  \n> Try adding the path to the system using sys.append()\n\nif it still doesn't work, then \nMethod 2: \n> you need to add all classes and methods in the notebook.",
      "votes": null
    },
    {
      "id": "1668044",
      "postDate": "01/29/2022 08:34:37",
      "content": "<p>I chose Method 2. And fortunately, it worked!</p>",
      "rawMarkdown": "I chose Method 2. And fortunately, it worked!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1667013,
      "author_name": "mahipalsingh",
      "author_url": "",
      "post_date": "01/28/2022 08:53:06",
      "content": "<p>I had this issue,<br>\nYou installed and imported yolov5 first, So It is importing model.model from yoloV5 lib instead of yoloR lib. </p>",
      "votes": null,
      "replies": [
        {
          "id": 1667026,
          "author_name": "dinowun",
          "author_url": "",
          "post_date": "01/28/2022 09:11:09",
          "content": "<p>So, how can I fix this problem?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1667105,
          "author_name": "mahipalsingh",
          "author_url": "",
          "post_date": "01/28/2022 10:15:29",
          "content": "<p>I was stuck on this error for 2 days,<br>\nAfter a lot of debugging I found this 2 ways to solve:<br>\nMethod 1:  </p>\n<blockquote>\n  <p>Try adding the path to the system using sys.append()</p>\n</blockquote>\n<p>if it still doesn't work, then <br>\nMethod 2: </p>\n<blockquote>\n  <p>you need to add all classes and methods in the notebook.</p>\n</blockquote>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1668044,
          "author_name": "dinowun",
          "author_url": "",
          "post_date": "01/29/2022 08:34:37",
          "content": "<p>I chose Method 2. And fortunately, it worked!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1667002": "Since I was working on a private notebook, compromising all three YOLOs, but when I got to YOLOR and started to import all modules necessary for YOLOR inference and then, instead threw an error saying that:\n```\n---------------------------------------------------------------------------\nModuleNotFoundError                       Traceback (most recent call last)\n/tmp/ipykernel_37/1101678443.py in <module>\n      9 \n     10 # YoloR methods\n---> 11 from models.models import Darknet\n     12 from utils.datasets import letterbox\n     13 from utils.general import non_max_suppression, scale_coords\n\nModuleNotFoundError: No module named 'models.models'\n```\nHere's the fragment adapted by YoloR Infer notebook, which is https://www.kaggle.com/remekkinas/yolor-p6-w6-one-more-yolo-on-kaggle-infer/data\n```\nimport torch\nimport cv2\n\nimport pandas as pd\nimport numpy as np\n\nfrom utils.torch_utils import select_device\nfrom PIL import Image\n\n# YoloR methods\nfrom models.models import Darknet\nfrom utils.datasets import letterbox\nfrom utils.general import non_max_suppression, scale_coords\n```\nThe original notebook with YoloR only works for inference, but with my notebook, the question is, why do the weights.weights module is NOT FOUND?! Help!",
    "1667013": "I had this issue,\nYou installed and imported yolov5 first, So It is importing model.model from yoloV5 lib instead of yoloR lib.",
    "1667026": "So, how can I fix this problem?",
    "1667105": "I was stuck on this error for 2 days,\nAfter a lot of debugging I found this 2 ways to solve:\nMethod 1:  \n> Try adding the path to the system using sys.append()\n\nif it still doesn't work, then \nMethod 2: \n> you need to add all classes and methods in the notebook.",
    "1668044": "I chose Method 2. And fortunately, it worked!"
  },
  "source": "meta"
}