OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

ImportError: cannot import name ‘eval_pb2’ from ‘object_detection.protos’

  • Thread starter Thread starter Adesegun Daniel
  • Start date Start date
A

Adesegun Daniel

Guest
I'm encountering an ImportError related to the eval_pb2 module from the object_detection.protos package. Here are the details:


  • I'm working on an object detection project using TensorFlow and TensorFlow Hub.


  • I've set up my environment with TFRecords, label maps, and configuration files.


  • When I try to import config_util, I get the following error:

    Code:
    ImportError: cannot import name 'eval_pb2' from 'object_detection.protos'

Code:
import os
import cv2
import numpy as np
import pandas as pd 
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow_hub as hub
from PIL import Image
from tensorflow.data import Dataset
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Input, Dense, Dropout, Lambda
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.losses import BinaryCrossentropy
from tensorflow.keras.metrics import Accuracy
from sklearn.model_selection import train_test_split
from tensorflow.train import Feature, Features, BytesList, Int64List, FloatList, Example
from object_detection.utils import config_utils
from object_detection.builders import model_builder
from object_detection.utils import visualization_utils as viz_utils
from object_detection.utils import label_map_util
from object_detection.utils import dataset_utilfrom object_detection.utils import config_util

# ... other code ...

# The error occurs here:
from object_detection.protos import eval_pb2
  • OS: Windows 10
  • TensorFlow installation method: pip

Expected Outcome:

  • I expect to resolve the ImportError and successfully import eval_pb2.

Any guidance on resolving this issue would be greatly appreciated! Thank you

  • I've compiled the necessary Protocol Buffers (protobuf) files using protoc.
  • I've verified that the eval_pb2 file exists in the correct location.
  • I'm using TensorFlow version 2.15.1.
<p>I'm encountering an <code>ImportError</code> related to the <code>eval_pb2</code> module from the <code>object_detection.protos</code> package. Here are the details:</p>
<ul>
<li><p>I'm working on an object detection project using TensorFlow and TensorFlow Hub.</p>
</li>
<li><p>I've set up my environment with TFRecords, label maps, and configuration files.</p>
</li>
<li><p>When I try to import <code>config_util</code>, I get the following error:</p>
<pre><code>ImportError: cannot import name 'eval_pb2' from 'object_detection.protos'
</code></pre>
</li>
</ul>
<pre class="lang-py prettyprint-override"><code>import os
import cv2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow_hub as hub
from PIL import Image
from tensorflow.data import Dataset
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Input, Dense, Dropout, Lambda
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.losses import BinaryCrossentropy
from tensorflow.keras.metrics import Accuracy
from sklearn.model_selection import train_test_split
from tensorflow.train import Feature, Features, BytesList, Int64List, FloatList, Example
from object_detection.utils import config_utils
from object_detection.builders import model_builder
from object_detection.utils import visualization_utils as viz_utils
from object_detection.utils import label_map_util
from object_detection.utils import dataset_utilfrom object_detection.utils import config_util

# ... other code ...

# The error occurs here:
from object_detection.protos import eval_pb2
</code></pre>
<ul>
<li>OS: Windows 10</li>
<li>TensorFlow installation method: pip</li>
</ul>
<p><strong>Expected Outcome</strong>:</p>
<ul>
<li>I expect to resolve the <code>ImportError</code> and successfully import <code>eval_pb2</code>.</li>
</ul>
<p>Any guidance on resolving this issue would be greatly appreciated!
Thank you</p>
<ul>
<li>I've compiled the necessary Protocol Buffers (protobuf) files using <code>protoc</code>.</li>
<li>I've verified that the <code>eval_pb2</code> file exists in the correct location.</li>
<li>I'm using TensorFlow version 2.15.1.</li>
</ul>
 
Top