PS D:\RealTimeObjectDetection> python Tensorflow/models/research/object_detection/model_main_tf2.py --model_dir=Tensorflow/workspace/models/my_ssd_mobnet --pipeline_config_path=Tensorflow/workspace/models/my_ssd_mobnet/pipeline.config --num_train_steps=10000
Traceback (most recent call last):
File "D:\RealTimeObjectDetection\Tensorflow\models\research\object_detection\model_main_tf2.py", line 31, in <module>
import model_lib_v2
File "D:\RealTimeObjectDetection\Tensorflow\models\research\object_detection\model_lib_v2.py", line 29, in <module>
import eval_util
File "D:\RealTimeObjectDetection\Tensorflow\models\research\object_detection\eval_util.py", line 35, in <module>
from object_detection.metrics import coco_evaluation
File "D:\RealTimeObjectDetection\Tensorflow\models\research\object_detection\metrics\coco_evaluation.py", line 28, in <module>
from object_detection.utils import object_detection_evaluation
File "D:\RealTimeObjectDetection\Tensorflow\models\research\object_detection\utils\object_detection_evaluation.py", line 46, in <module>
from object_detection.utils import label_map_util
File "D:\RealTimeObjectDetection\Tensorflow\models\research\object_detection\utils\label_map_util.py", line 29, in <module>
from object_detection.protos import string_int_label_map_pb2
File "D:\RealTimeObjectDetection\Tensorflow\models\research\object_detection\protos\string_int_label_map_pb2.py", line 9, in <module>
from google.protobuf import runtime_version as _runtime_version
ImportError: cannot import name 'runtime_version' from 'google.protobuf' (C:\Users\varda\AppData\Local\Programs\Python\Python311\Lib\site-packages\google\protobuf\__init__.py)
是版本错误吗?我还尝试在用户变量中设置 PYTHONPATH 变量,但编译器仍在查找 object_detection 文件的站点包,而我将路径设置为 D 驱动器中的不同位置
最近发布的 NumPy 2.0 给依赖旧版本 NumPy 的软件包带来了一些问题。要查看安装了哪个版本的 numpy,请运行
pip list
在命令行中。输出示例:
Package Version
------- -------
numpy 2.0.0
pip 24.1
要降级到旧版本:
pip install numpy==1.26.4