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:ImportError: cannot import name 'eval_pb2' from 'object_detection.protos'
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 importeval_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.
Adesegun Daniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.