ImportError: cannot import name 'estimator' from 'tensorflow.compat.v1'
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python, tensorflow
调研方向
首先,根据 object_detection/packages/tf2/setup.py 复现报告中的设置,并使用 TensorFlow 2.17 运行 object_detection/model_main_tf2.py。检查导入 tensorflow.compat.v1.estimator 的 object_detection/inputs.py,并比较受支持的依赖项版本。当文档中记录的安装过程在 model_main_tf2.py 启动时不再引发此 ImportError,即表示完成。
由索引模型根据 Issue 内容生成。
描述
I try to train an ssd_mobilenetv1 tflite model in wsl2 ubuntu22 with tensorflow 2.17 and python3.10.
My step is:
git clone https://github.com/tensorflow/models.git
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install .
python model_main_tf2.py \
--pipeline_config_path=/mnt/d/workspace/PycharmProjects/models/research/object_detection/configs/tf2/ssd_mobilenet_v1_fpn_640x640_coco17_tpu-8.config \
--model_dir=/mnt/d/workspace/imgupload/img/selected1/bt3/train/model \
--alsologtostderr
but the errors occured:
2024-08-13 23:38:50.434079: I tensorflow/core/util/port.cc:153] 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.
2024-08-13 23:38:50.673212: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-08-13 23:38:50.795309: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-08-13 23:38:50.822108: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-08-13 23:38:51.054283: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-08-13 23:38:53.083424: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
File "/home/lbf/models/research/object_detection/model_main_tf2.py", line 31, in
from object_detection import model_lib_v2
File "/home/lbf/env2/lib/python3.10/site-packages/object_detection/model_lib_v2.py", line 30, in
from object_detection import inputs
File "/home/lbf/env2/lib/python3.10/site-packages/object_detection/inputs.py", line 24, in
from tensorflow.compat.v1 import estimator as tf_estimator
ImportError: cannot import name 'estimator' from 'tensorflow.compat.v1' (/home/lbf/env2/lib/python3.10/site-packages/tensorflow/_api/v2/compat/v1/init.py)
- 主要语言
- Python
- 星标
- 77.6k
- 派生
- 44.8k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tensorflow/models 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
tensorflow/models#13653 ·
-
object_detection_tutorial.ipynb pretrained model "resnet50 imagenet"可能重新可做 @laxmareddyp 于 202 天前认领,目前没有进行中的 PR。 未关闭type:support
tensorflow/models#13634 · 2 条评论 · 1 个 reaction · 已指派 1 人 ·
-
Tag version compatible with Tensorflow 2.20可能重新可做 @bharatjetti 于 277 天前认领,目前没有进行中的 PR。 未关闭models:official type:bug
tensorflow/models#13607 · 1 条评论 · 已指派 1 人 ·
-
models:research type:feature
难度 5/5 一周以上 新手友好度 10/100
tensorflow/models#13600 ·
-
Installation Issues on Python 3.13可能重新可做 @bharatjetti 于 246 天前认领,目前没有进行中的 PR。 未关闭models:official type:bug
tensorflow/models#13587 · 9 条评论 · 已指派 1 人 ·
查看 tensorflow/models 的全部 Issue
相似的 Issue
-
cli good first issue help wanted python up-for-grabs
难度 2/5 1-3 小时 新手友好度 75/100
andrewsiah/agentswarm-data-tasks#36 ·
维护者通常 1 天内回复
-
bug drawing-tools
难度 2/5 1-3 小时 新手友好度 76/100
cofade/open-garden-planner#827 ·
维护者通常 1 天内回复
-
Methodology page未关闭documentation site texts
难度 2/5 1-3 小时 新手友好度 67/100
Krasnopjorovs/temet#66 ·
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复