Closed radzfoto closed 7 years ago
haha funny story this error AttributeError: 'dict' object has no attribute 'iteritems' -plagued me in a live demo I built it and ran it fine I thought but after pulling my code to a different machine (at the podium ) it was failing... maybe it was the slight jump from python 3.5.x-n to 3.5.x? I found this error in the demo with python 3.5.4; the error resulting from a 0.0.x release is od I bet I was just developing under 2.7... here is where the function changes are mentioned... https://stackoverflow.com/questions/10458437/what-is-the-difference-between-dict-items-and-dict-iteritems I might make a pull request tonight :)
you can use my fork https://github.com/fenderrex/models until its merged. I recommend you remove the tags this was a project for someone who has used both 2.7 and 3.5 its nothing about tensorflow core concepts @radzfoto did an awesome job interpreting the error.
@fenderrex Can you send a pull request for this ? Thank you.
System information
Tensorflow version: v1.3.0-rc2-20-g0787eee 1.3.0 (installed from package, i.e. binary) == tensorflow import ============================================ tf.VERSION = 1.3.0 tf.GIT_VERSION = v1.3.0-rc2-20-g0787eee tf.COMPILER_VERSION = v1.3.0-rc2-20-g0787eee Sanity check: array([1], dtype=int32)
Working directory: ~/tensorflow/models/research
No custom code
Linux Ubuntu 16.04
Python version 3.6.3, using GCC 5.4.0 20160609
CUDA/cuDNN version: CUDA 8.0, cudnn 6.0, nVidia driver: 384.90
GPU: nVidia TitanXp 12GB memory
CPU: Intel x86-64 Intel Core i7-7700K @ 4.20GHz x 8, 32GB memory
Command to reproduce: python object_detection/builders/model_builder_test.py
Describe the problem
object_detection model_builder_test.py fails with Python 3.x This appears to be a bug in Python 3.x compatibility in the object_detection/model_builder_test.py file. The code uses the following lines: Line 334:
for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.iteritems():
Line 773:for extractor_type, extractor_class in FEATURE_EXTRACTOR_MAPS.iteritems():
In Python 3.x, dicts no longer support the attribute.iteritem()
. It needs to be changed to.item()
. When I changed the two lines as above, the code works fine in Python 3.6. However, for a complete solution, the code should check which Python version is being used and run the appropriate code for that version.Here is the error log: .....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 334, 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 733, 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 11 tests in 0.040s
FAILED (errors=2)