I am not able to compile Attention_ocr project. I am getting error while executing
"python3 -m unittest discover -p '*_test.py'"
======================================================================
ERROR: data_provider_test (unittest.loader._FailedTest)
ImportError: Failed to import test module: data_provider_test
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
module = self._get_module_from_name(name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
__import__(name)
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/data_provider_test.py", line 22, in
import datasets
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/datasets/__init__.py", line 16, in
import fsns
ModuleNotFoundError: No module named 'fsns'======================================================================
ERROR: datasets (unittest.loader._FailedTest)
ImportError: Failed to import test module: datasets
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 462, in _find_test_path
package = self._get_module_from_name(name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
__import__(name)
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/datasets/__init__.py", line 16, in
import fsns
ModuleNotFoundError: No module named 'fsns'======================================================================
ERROR: demo_inference_test (unittest.loader._FailedTest)
ImportError: Failed to import test module: demo_inference_test
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
module = self._get_module_from_name(name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
__import__(name)
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/demo_inference_test.py", line 3, in
import demo_inference
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/demo_inference.py", line 25, in
import common_flags
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/common_flags.py", line 22, in
import datasets
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/datasets/__init__.py", line 16, in
import fsns
ModuleNotFoundError: No module named 'fsns'======================================================================
ERROR: test_text_corresponds_to_ids (model_test.CharsetMapperTest)
Traceback (most recent call last):
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model_test.py", line 269, in test_text_corresponds_to_ids
charset_mapper = model.CharsetMapper(charset)
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model.py", line 86, in __init__
mapping_strings = tf.constant(_dict_to_array(charset, default_character))
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model.py", line 66, in _dict_to_array
for k, v in id_to_char.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'======================================================================
ERROR: test_create_summaries_is_runnable (model_test.ModelTest)
Traceback (most recent call last):
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model_test.py", line 149, in test_create_summaries_is_runnable
data, endpoints, charset, is_training=False)
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model.py", line 537, in create_summaries
for name, value in names_to_values.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'======================================================================
ERROR: test_predicted_text_has_correct_shape_w_charset (model_test.ModelTest)
Traceback (most recent call last):
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model_test.py", line 254, in test_predicted_text_has_correct_shape_w_charset
images=self.fake_images, labels_one_hot=None)
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model.py", line 379, in create_base
character_mapper = CharsetMapper(self._charset)
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model.py", line 86, in __init__
mapping_strings = tf.constant(_dict_to_array(charset, default_character))
File "/Users/mavya.soni/Documents/Project/Monoca_Phase2/OCR/models-master/research/attention_ocr/python/model.py", line 66, in _dict_to_array
for k, v in id_to_char.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
Ran 26 tests in 31.173s
FAILED (errors=6)
Please provide details about what platform you are using (operating system, architecture). Also include your TensorFlow version. Also, did you compile from source or install a binary? Make sure you also include the exact command if possible to produce the output included in your test case. If you are unclear what to include see the issue template displayed in the Github new issue template.
We ask for this in the issue submission template, because it is really difficult to help without that information. Thanks!
Try rewrite import fsnsto from . import fsns in /datasets/init.py
i got the same error.anybody can solve this?thank you!
from datasets import fsns
when using python 3.6 this error occurred, but not for python 2.7
Closing as the issue is resolved
I too am getting this error! I have tried the above steps of changing the paths and imports. Nothing has worked. Trying this in colab
Traceback (most recent call last):
File "train.py", line 30, in <module>
import common_flags
File "/content/models/research/attention_ocr/python/common_flags.py", line 22, in <module>
import datasets
File "/content/models/research/attention_ocr/python/datasets/__init__.py", line 17, in <module>
from datasets import fsns_test
File "/content/models/research/attention_ocr/python/datasets/fsns_test.py", line 23, in <module>
import fsns
ModuleNotFoundError: No module named 'fsns'
You need to setup PYTHONPATH to current dataset directory. Like in Windows.
from python/datasets
set PYTHONAPTYH=YOUR_PATH\python\datasets
I have the same issue. Anybody solved it?
Most helpful comment
Try rewrite
import fsnstofrom . import fsnsin /datasets/init.py