没有名为“tensorflow.python.keras.layers.preprocessing”的模块

问题描述 投票:0回答:1

嗨,我想从 cmd 运行此代码,但出现此错误;

2024-01-19 21:35:58.289319: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
WARNING:tensorflow:From C:\Users\user\anaconda3\Lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

Traceback (most recent call last):
  File "C:\Users\user\anaconda3\Lib\site-packages\object_detection\models\ssd_efficientnet_bifpn_feature_extractor.py", line 35, in <module>
    from official.legacy.image_classification.efficientnet import efficientnet_model
ModuleNotFoundError: No module named 'official.legacy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\Desktop\RealTimeObjectDetection\RealTimeObjectDetection\Tensorflow\models\research\object_detection\model_main_tf2.py", line 32, in <module>
    from object_detection import model_lib_v2
  File "C:\Users\user\anaconda3\Lib\site-packages\object_detection\model_lib_v2.py", line 30, in <module>
    from object_detection import inputs
  File "C:\Users\user\anaconda3\Lib\site-packages\object_detection\inputs.py", line 27, in <module>
    from object_detection.builders import model_builder
  File "C:\Users\user\anaconda3\Lib\site-packages\object_detection\builders\model_builder.py", line 70, in <module>
    from object_detection.models import ssd_efficientnet_bifpn_feature_extractor as ssd_efficientnet_bifpn
  File "C:\Users\user\anaconda3\Lib\site-packages\object_detection\models\ssd_efficientnet_bifpn_feature_extractor.py", line 37, in <module>
    from official.vision.image_classification.efficientnet import efficientnet_model
  File "C:\Users\user\anaconda3\Lib\site-packages\official\vision\image_classification\efficientnet\efficientnet_model.py", line 37, in <module>
    from official.vision.image_classification import preprocessing
  File "C:\Users\user\anaconda3\Lib\site-packages\official\vision\image_classification\preprocessing.py", line 25, in <module>
    from official.vision.image_classification import augment
  File "C:\Users\user\anaconda3\Lib\site-packages\official\vision\image_classification\augment.py", line 31, in <module>
    from tensorflow.python.keras.layers.preprocessing import image_preprocessing as image_ops
ModuleNotFoundError: No module named 'tensorflow.python.keras.layers.preprocessing'
PS C:\Users\user\Desktop\RealTimeObjectDetection\RealTimeObjectDetection>

python版本3.11.5 张量流版本 2.15

我想要对象检测程序,此代码用于训练模型。

提前致谢

python-3.x tensorflow object-detection-api
1个回答
0
投票

你可以尝试

pip install object-detection
pip install tf-models-official
吗?

© www.soinside.com 2019 - 2024. All rights reserved.