{
  "id": 166075,
  "title": "YOLO 'tensorflow.python.keras.engine.base_layer_v1",
  "url": "/competitions/global-wheat-detection/discussion/166075",
  "author_name": "",
  "post_date": "2020-07-11T18:50:59.861089800Z",
  "votes": null,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Hello Guys.</p>\n\n<p>I would like to know if anyone has encountered this error when training YOLOv3</p>\n\n<p>ModuleNotFoundError: No module named 'tensorflow.python.keras.engine.base_layer_v1</p>\n\n<p>I installed Tensorflow 1.14 as I read YOLO does not work with 2.2 which is the one we have in the Kernel.</p>\n\n<p>Does anyone have an idea?</p>",
  "messages": [
    {
      "id": "924986",
      "postDate": "07/11/2020 18:50:59",
      "content": "<p>Hello Guys.</p>\n\n<p>I would like to know if anyone has encountered this error when training YOLOv3</p>\n\n<p>ModuleNotFoundError: No module named 'tensorflow.python.keras.engine.base_layer_v1</p>\n\n<p>I installed Tensorflow 1.14 as I read YOLO does not work with 2.2 which is the one we have in the Kernel.</p>\n\n<p>Does anyone have an idea?</p>",
      "rawMarkdown": "Hello Guys.\n\nI would like to know if anyone has encountered this error when training YOLOv3\n\nModuleNotFoundError: No module named 'tensorflow.python.keras.engine.base_layer_v1\n\nI installed Tensorflow 1.14 as I read YOLO does not work with 2.2 which is the one we have in the Kernel.\n\nDoes anyone have an idea?",
      "votes": null
    },
    {
      "id": "927472",
      "postDate": "07/13/2020 12:14:04",
      "content": "<p>Well, it looks that I am doing things wrong or more difficult since no one encounter this error. I found the solution.</p>\n\n<p>from keras.preprocessing import image\nfrom keras.models import Model\nfrom keras.layers import Dense, GlobalAveragePooling2D\nfrom keras import backend as K\nto:</p>\n\n<p>from tensorflow.keras.preprocessing import image\nfrom tensorflow.keras.models import Model\nfrom tensorflow.keras.layers import Dense, GlobalAveragePooling2D\nfrom tensorflow.keras import backend as K</p>\n\n<p>If you have the same problem. \nYOLO files are outdated. They are said that they are not compatible with Tensorflow 1.14 but for me it worked with Keras 2.0.2. If downgraded, keras won't find engine.base_layer_v1. I needed to fork the git and edit the model.py. As shown above the important thing is add tensorflow.keras</p>\n\n<p>I also needed to edit Change K.control_flow_ops.while_loop to tf.while_loop in the code or will give you an error. </p>\n\n<p>I hope this is useful. It took me 4 days to solve this.</p>\n\n<p>Here my git with the changes if needed luisvivasg/YOLOv3-object-detection-tutorial</p>",
      "rawMarkdown": "Well, it looks that I am doing things wrong or more difficult since no one encounter this error. I found the solution.\n\nfrom keras.preprocessing import image\nfrom keras.models import Model\nfrom keras.layers import Dense, GlobalAveragePooling2D\nfrom keras import backend as K\nto:\n\nfrom tensorflow.keras.preprocessing import image\nfrom tensorflow.keras.models import Model\nfrom tensorflow.keras.layers import Dense, GlobalAveragePooling2D\nfrom tensorflow.keras import backend as K\n\nIf you have the same problem. \nYOLO files are outdated. They are said that they are not compatible with Tensorflow 1.14 but for me it worked with Keras 2.0.2. If downgraded, keras won't find engine.base_layer_v1. I needed to fork the git and edit the model.py. As shown above the important thing is add tensorflow.keras\n\nI also needed to edit Change K.control_flow_ops.while_loop to tf.while_loop in the code or will give you an error. \n\nI hope this is useful. It took me 4 days to solve this.\n\n\nHere my git with the changes if needed luisvivasg/YOLOv3-object-detection-tutorial",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 927472,
      "author_name": "luisvivas",
      "author_url": "",
      "post_date": "07/13/2020 12:14:04",
      "content": "<p>Well, it looks that I am doing things wrong or more difficult since no one encounter this error. I found the solution.</p>\n\n<p>from keras.preprocessing import image\nfrom keras.models import Model\nfrom keras.layers import Dense, GlobalAveragePooling2D\nfrom keras import backend as K\nto:</p>\n\n<p>from tensorflow.keras.preprocessing import image\nfrom tensorflow.keras.models import Model\nfrom tensorflow.keras.layers import Dense, GlobalAveragePooling2D\nfrom tensorflow.keras import backend as K</p>\n\n<p>If you have the same problem. \nYOLO files are outdated. They are said that they are not compatible with Tensorflow 1.14 but for me it worked with Keras 2.0.2. If downgraded, keras won't find engine.base_layer_v1. I needed to fork the git and edit the model.py. As shown above the important thing is add tensorflow.keras</p>\n\n<p>I also needed to edit Change K.control_flow_ops.while_loop to tf.while_loop in the code or will give you an error. </p>\n\n<p>I hope this is useful. It took me 4 days to solve this.</p>\n\n<p>Here my git with the changes if needed luisvivasg/YOLOv3-object-detection-tutorial</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "924986": "Hello Guys.\n\nI would like to know if anyone has encountered this error when training YOLOv3\n\nModuleNotFoundError: No module named 'tensorflow.python.keras.engine.base_layer_v1\n\nI installed Tensorflow 1.14 as I read YOLO does not work with 2.2 which is the one we have in the Kernel.\n\nDoes anyone have an idea?",
    "927472": "Well, it looks that I am doing things wrong or more difficult since no one encounter this error. I found the solution.\n\nfrom keras.preprocessing import image\nfrom keras.models import Model\nfrom keras.layers import Dense, GlobalAveragePooling2D\nfrom keras import backend as K\nto:\n\nfrom tensorflow.keras.preprocessing import image\nfrom tensorflow.keras.models import Model\nfrom tensorflow.keras.layers import Dense, GlobalAveragePooling2D\nfrom tensorflow.keras import backend as K\n\nIf you have the same problem. \nYOLO files are outdated. They are said that they are not compatible with Tensorflow 1.14 but for me it worked with Keras 2.0.2. If downgraded, keras won't find engine.base_layer_v1. I needed to fork the git and edit the model.py. As shown above the important thing is add tensorflow.keras\n\nI also needed to edit Change K.control_flow_ops.while_loop to tf.while_loop in the code or will give you an error. \n\nI hope this is useful. It took me 4 days to solve this.\n\n\nHere my git with the changes if needed luisvivasg/YOLOv3-object-detection-tutorial"
  },
  "source": "meta"
}