我有一个错误
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 我正在通过 cmd 运行 model_builder_tf2_test.py 并发生此错误
文件脚本
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')
我在这段代码中遇到了同样的问题:
import matplotlib
import matplotlib.pyplot as plt
import io
import scipy.misc
import numpy as np
from six import BytesIO
from PIL import Image, ImageDraw, ImageFont
from object_detection.utils import label_map_util
from object_detection.utils import config_util
from object_detection.utils import visualization_utils as viz_utils
from object_detection.builders import model_builder
%matplotlib inline
错误如下: