发生异常:ImportError 无法从“object_detection.protos”导入名称“string_int_label_map_pb2”

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

我在此代码中遇到导入错误,请帮我解决它在标签映射实用程序函数中,我不需要代码来修复它,我需要如何解决此导入错误。

"""Label map utility functions."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import collections
import logging
import sys
sys.path.append('models/research/object_detection')
import numpy as np
from six import string_types
from six.moves import range
import tensorflow.compat.v1 as tf
from google.protobuf import text_format
import object_detection
from object_detection.protos import string_int_label_map_pb2
python tensorflow object-detection
1个回答
0
投票

您只需将这些文件放在同一个文件夹中并写入即可

import string_int_label_map_pb2

而不是

from object_detection.protos import string_int_label_map_pb2

还要确保您已将 protos 文件转换为 .py 文件。

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