importError: cannot import name 'model_builder' from 'object_detection.builders' (unknown location)
importError: cannot import name 'model_builder' from 'object_detection.builders' (unknown location)
我遇到了一个错误
Traceback (most recent call last):
File "c:/Users/User/Documents/Projects/Tensorflow/models/research/object_detection/builders/model_builder_tf2_test.py", line 24, in <module>
from object_detection.builders import model_builder
ImportError: cannot import name 'model_builder' from 'object_detection.builders' (unknown location)
我的文件夹里有init
我是 运行 model_builder_tf2_test.py 通过 cmd 并且发生此错误
文件脚本
import unittest
import tensorflow.compat.v1 as tf
from google.protobuf import text_format
from object_detection.builders import model_builder
from object_detection.builders import model_builder_test
from object_detection.core import losses
from object_detection.models import center_net_resnet_feature_extractor
from object_detection.protos import center_net_pb2
from object_detection.protos import model_pb2
from object_detection.utils import tf_version
这个位置需要在 PATH
所以试试这个:
import sys
sys.path.append('path/to/Tensorflow/models/research')
我遇到了一个错误
Traceback (most recent call last):
File "c:/Users/User/Documents/Projects/Tensorflow/models/research/object_detection/builders/model_builder_tf2_test.py", line 24, in <module>
from object_detection.builders import model_builder
ImportError: cannot import name 'model_builder' from 'object_detection.builders' (unknown location)
我的文件夹里有init 我是 运行 model_builder_tf2_test.py 通过 cmd 并且发生此错误
文件脚本
import unittest
import tensorflow.compat.v1 as tf
from google.protobuf import text_format
from object_detection.builders import model_builder
from object_detection.builders import model_builder_test
from object_detection.core import losses
from object_detection.models import center_net_resnet_feature_extractor
from object_detection.protos import center_net_pb2
from object_detection.protos import model_pb2
from object_detection.utils import tf_version
这个位置需要在 PATH
所以试试这个:
import sys
sys.path.append('path/to/Tensorflow/models/research')