我正在尝试使用Tensorflow Object Detection API,如here所述。
我完全按照那里描述的那样做了,但是我收到了以下错误:
python3 object_detection/builders/model_builder_test.py
..EE...
======================================================================
ERROR: test_create_faster_rcnn_resnet_v1_models_from_config (__main__.ModelBuilderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "object_detection/builders/model_builder_test.py", line 258, in test_create_faster_rcnn_resnet_v1_models_from_config
for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
======================================================================
ERROR: test_create_rfcn_resnet_v1_model_from_config (__main__.ModelBuilderTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "object_detection/builders/model_builder_test.py", line 448, in test_create_rfcn_resnet_v1_model_from_config
for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
----------------------------------------------------------------------
Ran 7 tests in 0.019s
FAILED (errors=2)
请帮助我了解那里有什么问题,非常感谢!
答案 0 :(得分:4)
当你在python3中时,使用dict.items()而不是dict.iteritems()
Python 3中不存在iteritems()。
答案 1 :(得分:1)
您必须使用diction.items()
函数。一个例子是:
dict = {'Name': 'Zara', 'Age': 7}
print ("Value : %s" % dict.items())
输出:
Value : dict_items([('Name', 'Zara'), ('Age', 7)])