我正在嘗試使用 TensorFlow 訓練模型。
跑步時
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=5000
我明白了
ImportError: cannot import name 'model_lib_v2' from 'object_detection' (C:\Users\lais\AppData\Local\Programs\Python\Python39\lib\site-packages\object_detection\__init__.py)
這是我的目錄結構
RealTimeDetection
Tensorflow
workspace
models
research
object_detection
model_main_tf2.py
model_lib_v2.py
模型檔案夾來自https://github.com/tensorflow/models所以我知道它應該可以作業
我認為它不作業的原因是,model_main_tf2.py 試圖從
C:\Users\lais\AppData\Local\Programs\Python\Python39\lib\site-packages\object_detection\
而不是來自
C:\Users\lais\Desktop\SP\CIOT\projects\RealTimeObjectDetection\Tensorflow\models\research\object_detection
如何讓代碼在 models\research\object_detection 中查找庫?還是我的理論錯了?
uj5u.com熱心網友回復:
您可以嘗試通過以“.”開頭的匯入來使用相對匯入。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/362368.html
