models icon indicating copy to clipboard operation
models copied to clipboard

from object_detection.utils import dataset_util ImportError: No module named object_detection.utils

Open sainttelant opened this issue 9 years ago • 21 comments

when i tried to train pet detecter tutorials followed by instructions steps by steps, i 've already added PYTHONPATH, and run model_test.py successfully, and meantime, i 've added export pythonpath in bashrc manually,and successfully, however, i executed the code to transfer pet_tf_record, it occurred the error as follows like;

/usr/local/lib/python3.5/dist-packages/tensorflow/models/research$ sudo python object_detection/create_pet_tf_record.py --label_map_path=object_detection/data/pet_label_map.pbtxt --data_dir=pwd --output_dir=pwd Traceback (most recent call last): File "object_detection/create_pet_tf_record.py", line 39, in from object_detection.utils import dataset_util ImportError: No module named object_detection.utils

how to solve it?plz tell me why?

sainttelant avatar Oct 17 '17 09:10 sainttelant

What are the values for your python path?

drpngx avatar Oct 17 '17 20:10 drpngx

hi, drpngx , i deployed the codes on the Google cloud, and the PYthonpath is ' ['', '/usr/local/lib/python3.5/dist-packages/tensorflow/models/research/slim', '/home/goldedseito_saga', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/home/goldedseito_saga/.local/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']

i 've already added slim directory in the pythonpath through modifing profile as follows:

export PYTHONPATH=/usr/local/lib/python3.5/dist-packages/tensorflow/models/research/slim:$PYTHONPATH

sainttelant avatar Oct 18 '17 01:10 sainttelant

so it is weird to encounter such errors, because it can execute successfully through model_builder_test.py in installing instruction, any suggestions?

sainttelant avatar Oct 18 '17 01:10 sainttelant

okay, i found the solution to solve it, i tried to python3 setup.py build and install in research folder, after done that, i executed the code,and worked

sainttelant avatar Oct 18 '17 03:10 sainttelant

okay, i found the solution to solve it, i tried to python3 setup.py build and install in research folder, after done that, i executed the code,and worked

So what you did? Tried to execute python3 setup.py file in research directory?

jaskierLTD avatar Jun 22 '18 08:06 jaskierLTD

I had found the solution (MAC OS):

  1. https://github.com/tensorflow/models Download.
  2. Go to folder "research".
  3. Open terminal: cd Downloads/models-master/research

(for 2.7python) python setup.py build (for 3.6python) python3.6 setup.py build 5. (for 2.7python) sudo python setup.py install (for 3.6python) sudo python3.6 setup.py install 6. You'll see : "Finished processing dependencies for object-detection==0.1"

Now, you can run your .py without object_detection error.

jaskierLTD avatar Jun 22 '18 09:06 jaskierLTD

I am facing same error. I ran the same command in windows.... python setup.py install. But It wont be work for me... Any one can please help me to figure out the solution...??

nimeshrajput5211 avatar Jul 11 '18 09:07 nimeshrajput5211

may be due to python 2 i tried the steps by @jaskierLTD in python3 environment and it worked

sandeshvijayraj avatar Oct 31 '18 07:10 sandeshvijayraj

@jaskierLTD You are genius . Saved my day. Thanks a ton !!

tanajikamble13 avatar Nov 20 '18 13:11 tanajikamble13

@jaskierLTD my problem is solved by training with train.py script. But i am unable to run model_main.py I am getting following error:

Tensorflow/core/framework/op_kernel.cc:1261] Invalid argument: TypeError: 'int' object is not iterable Traceback (most recent call last):

File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/script_ops.py", line 206, in call ret = func(*args)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 358, in first_value_func self._metrics = self.evaluate()

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 207, in evaluate self._detection_boxes_list)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_tools.py", line 134, in LoadAnnotations results.createIndex()

File "/usr/local/lib/python3.4/dist-packages/pycocotools/coco.py", line 106, in createIndex for cat in self.dataset['categories']:

TypeError: 'int' object is not iterable

Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1292, in _do_call return fn(*args) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1277, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1367, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.OutOfRangeError: End of sequence [[{{node IteratorGetNext}} = IteratorGetNextoutput_shapes=[[1], [1,300,300,3], [1,300,300,3], [1,2], [1,3], [1,100], [1,100,4], [1,100,1], [1,100,1], [1,100], [1,100], [1,100], [1]], output_types=[DT_INT32, DT_FLOAT, DT_UINT8, DT_INT32, DT_INT32, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32, DT_BOOL, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/evaluation.py", line 212, in _evaluate_once session.run(eval_ops, feed_dict) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 671, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1148, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1239, in run raise six.reraise(*original_exc_info) File "/usr/local/lib/python3.4/dist-packages/six.py", line 693, in reraise raise value File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1224, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1296, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1076, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 887, in run run_metadata_ptr) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1110, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1286, in _do_run run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1308, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.OutOfRangeError: End of sequence [[{{node IteratorGetNext}} = IteratorGetNextoutput_shapes=[[1], [1,300,300,3], [1,300,300,3], [1,2], [1,3], [1,100], [1,100,4], [1,100,1], [1,100,1], [1,100], [1,100], [1,100], [1]], output_types=[DT_INT32, DT_FLOAT, DT_UINT8, DT_INT32, DT_INT32, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32, DT_BOOL, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

Caused by op 'IteratorGetNext', defined at: File "legacy/model_main.py", line 109, in tf.app.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "legacy/model_main.py", line 105, in main tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0]) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 471, in train_and_evaluate return executor.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 610, in run return self.run_local() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 711, in run_local saving_listeners=saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 356, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1181, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1215, in _train_model_default saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1409, in _train_with_estimator_spec _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss]) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 671, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1148, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1224, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1304, in run run_metadata=run_metadata)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/basic_session_run_hooks.py", line 581, in after_run if self._save(run_context.session, global_step): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/basic_session_run_hooks.py", line 606, in _save if l.after_save(session, step): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 517, in after_save self._evaluate(global_step_value) # updates self.eval_result File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 537, in _evaluate self._evaluator.evaluate_and_export()) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 912, in evaluate_and_export hooks=self._eval_spec.hooks) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 476, in evaluate return _evaluate() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 462, in _evaluate self._evaluate_build_graph(input_fn, hooks, checkpoint_path)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1422, in _evaluate_build_graph self._call_model_fn_eval(input_fn, self.config)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1455, in _call_model_fn_eval input_fn, model_fn_lib.ModeKeys.EVAL) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1049, in _get_features_and_labels_from_input_fn self._call_input_fn(input_fn, mode)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/util.py", line 111, in parse_input_fn_result result = iterator.get_next() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/data/ops/iterator_ops.py", line 420, in get_next name=name)), self._output_types, File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/gen_dataset_ops.py", line 2069, in iterator_get_next output_shapes=output_shapes, name=name) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/ops.py", line 3272, in create_op op_def=op_def) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/ops.py", line 1768, in init self._traceback = tf_stack.extract_stack()

OutOfRangeError (see above for traceback): End of sequence [[{{node IteratorGetNext}} = IteratorGetNextoutput_shapes=[[1], [1,300,300,3], [1,300,300,3], [1,2], [1,3], [1,100], [1,100,4], [1,100,1], [1,100,1], [1,100], [1,100], [1,100], [1]], output_types=[DT_INT32, DT_FLOAT, DT_UINT8, DT_INT32, DT_INT32, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32, DT_BOOL, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1292, in _do_call return fn(*args) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1277, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1367, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: TypeError: 'int' object is not iterable Traceback (most recent call last):

File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/script_ops.py", line 206, in call ret = func(*args)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 358, in first_value_func self._metrics = self.evaluate()

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 207, in evaluate self._detection_boxes_list)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_tools.py", line 134, in LoadAnnotations results.createIndex()

File "/usr/local/lib/python3.4/dist-packages/pycocotools/coco.py", line 106, in createIndex for cat in self.dataset['categories']:

TypeError: 'int' object is not iterable

 [[{{node PyFunc_3}} = PyFunc[Tin=[], Tout=[DT_FLOAT], token="pyfunc_5", _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "legacy/model_main.py", line 109, in tf.app.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "legacy/model_main.py", line 105, in main tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0]) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 471, in train_and_evaluate return executor.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 610, in run return self.run_local() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 711, in run_local saving_listeners=saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 356, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1181, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1215, in _train_model_default saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1409, in _train_with_estimator_spec _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss]) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 671, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1148, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1239, in run raise six.reraise(*original_exc_info) File "/usr/local/lib/python3.4/dist-packages/six.py", line 693, in reraise raise value File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1224, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1304, in run run_metadata=run_metadata)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/basic_session_run_hooks.py", line 581, in after_run if self._save(run_context.session, global_step): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/basic_session_run_hooks.py", line 606, in _save if l.after_save(session, step): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 517, in after_save self._evaluate(global_step_value) # updates self.eval_result File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 537, in _evaluate self._evaluator.evaluate_and_export()) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 912, in evaluate_and_export hooks=self._eval_spec.hooks) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 476, in evaluate return _evaluate() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 469, in _evaluate output_dir=self.eval_dir(name)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1528, in _evaluate_run config=self._session_config) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/evaluation.py", line 212, in _evaluate_once session.run(eval_ops, feed_dict) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 783, in exit self._close_internal(exception_type) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 816, in _close_internal h.end(self._coordinated_creator.tf_sess) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/basic_session_run_hooks.py", line 941, in end self._final_ops, feed_dict=self._final_ops_feed_dict) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 887, in run run_metadata_ptr) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1110, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1286, in _do_run run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 1308, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: TypeError: 'int' object is not iterable Traceback (most recent call last):

File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/script_ops.py", line 206, in call ret = func(*args)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 358, in first_value_func self._metrics = self.evaluate()

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 207, in evaluate self._detection_boxes_list)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_tools.py", line 134, in LoadAnnotations results.createIndex()

File "/usr/local/lib/python3.4/dist-packages/pycocotools/coco.py", line 106, in createIndex for cat in self.dataset['categories']:

TypeError: 'int' object is not iterable

 [[{{node PyFunc_3}} = PyFunc[Tin=[], Tout=[DT_FLOAT], token="pyfunc_5", _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

Caused by op 'PyFunc_3', defined at: File "legacy/model_main.py", line 109, in tf.app.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "legacy/model_main.py", line 105, in main tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0]) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 471, in train_and_evaluate return executor.run() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 610, in run return self.run_local() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 711, in run_local saving_listeners=saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 356, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1181, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1215, in _train_model_default saving_listeners) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1409, in _train_with_estimator_spec _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss]) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 671, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1148, in run run_metadata=run_metadata) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1224, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/monitored_session.py", line 1304, in run run_metadata=run_metadata)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/basic_session_run_hooks.py", line 581, in after_run if self._save(run_context.session, global_step): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/training/basic_session_run_hooks.py", line 606, in _save if l.after_save(session, step): File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 517, in after_save self._evaluate(global_step_value) # updates self.eval_result File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 537, in _evaluate self._evaluator.evaluate_and_export()) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/training.py", line 912, in evaluate_and_export hooks=self._eval_spec.hooks) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 476, in evaluate return _evaluate() File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 462, in _evaluate self._evaluate_build_graph(input_fn, hooks, checkpoint_path)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1422, in _evaluate_build_graph self._call_model_fn_eval(input_fn, self.config)) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1458, in _call_model_fn_eval features, labels, model_fn_lib.ModeKeys.EVAL, config) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/estimator/estimator.py", line 1169, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/model_lib.py", line 418, in model_fn eval_config, list(category_index.values()), eval_dict) File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/eval_util.py", line 848, in get_eval_metric_ops_for_evaluators eval_dict)) File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 368, in get_estimator_eval_metric_ops first_value_op = tf.py_func(first_value_func, [], tf.float32) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/script_ops.py", line 457, in py_func func=func, inp=inp, Tout=Tout, stateful=stateful, eager=False, name=name) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/script_ops.py", line 281, in _internal_py_func input=inp, token=token, Tout=Tout, name=name) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/gen_script_ops.py", line 129, in py_func "PyFunc", input=input, token=token, Tout=Tout, name=name) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/ops.py", line 3272, in create_op op_def=op_def) File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/ops.py", line 1768, in init self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): TypeError: 'int' object is not iterable Traceback (most recent call last):

File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/script_ops.py", line 206, in call ret = func(*args)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 358, in first_value_func self._metrics = self.evaluate()

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_evaluation.py", line 207, in evaluate self._detection_boxes_list)

File "/usr/local/lib/python3.4/dist-packages/object_detection-0.1-py3.4.egg/object_detection/metrics/coco_tools.py", line 134, in LoadAnnotations results.createIndex()

File "/usr/local/lib/python3.4/dist-packages/pycocotools/coco.py", line 106, in createIndex for cat in self.dataset['categories']:

TypeError: 'int' object is not iterable

 [[{{node PyFunc_3}} = PyFunc[Tin=[], Tout=[DT_FLOAT], token="pyfunc_5", _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

tanajikamble13 avatar Nov 22 '18 14:11 tanajikamble13

how do we undo this install? setup.py & start fresh?

AbhimanyuAryan avatar Jul 08 '19 09:07 AbhimanyuAryan

@jaskierLTD I by mistake did python install & now I'm doing the install again with python3(which is python 3.7.3

Setup script error:

Best match: matplotlib 3.1.1
Processing matplotlib-3.1.1.tar.gz
Writing /tmp/easy_install-bgguvpba/matplotlib-3.1.1/setup.cfg
Running matplotlib-3.1.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-bgguvpba/matplotlib-3.1.1/egg-dist-tmp-z3w6b8sn
error: Setup script exited with 
Beginning with Matplotlib 3.1, Python 3.6 or above is required.

This may be due to an out of date pip.

Make sure you have pip >= 9.0.1.

AbhimanyuAryan avatar Jul 08 '19 09:07 AbhimanyuAryan

for windows user......

import sys sys.path.append("{YOU_PATH}\models-master\research") sys.path.append("{YOU_PATH}\models-master\research\object_detection\utils")

PATH_TO_LABELS = 'data/mscoco_label_map.pbtxt'

thanks to https://github.com/temiklis

Sakifneoworld avatar Nov 19 '19 05:11 Sakifneoworld

@derekjchow @jaskierLTD I followed the steps (my path was right) and I did get "Finished processing dependencies for object-detection==0.1". But when I'm trying to run the code on Google Collab, I'm still getting the same error: Traceback (most recent call last): File "/content/generate_tfrecord.py", line 29, in from object_detection.utils import dataset_util, label_map_util ModuleNotFoundError: No module named 'object_detection'

SidMalladi avatar Jan 10 '21 10:01 SidMalladi

I had found the solution (MAC OS):

  1. https://github.com/tensorflow/models Download.
  2. Go to folder "research".
  3. Open terminal: cd Downloads/models-master/research

(for 2.7python) python setup.py build (for 3.6python) python3.6 setup.py build 5. (for 2.7python) sudo python setup.py install (for 3.6python) sudo python3.6 setup.py install 6. You'll see : "Finished processing dependencies for object-detection==0.1"

Now, you can run your .py without object_detection error.

Where is the setup.py? setup.py file does not exist in the folder ........./models-master/research. Thanks!

eagle-dot avatar Mar 05 '21 15:03 eagle-dot

I had found the solution (MAC OS):

  1. https://github.com/tensorflow/models Download.
  2. Go to folder "research".
  3. Open terminal: cd Downloads/models-master/research

(for 2.7python) python setup.py build (for 3.6python) python3.6 setup.py build 5. (for 2.7python) sudo python setup.py install (for 3.6python) sudo python3.6 setup.py install 6. You'll see : "Finished processing dependencies for object-detection==0.1" Now, you can run your .py without object_detection error.

Where is the setup.py? setup.py file does not exist in the folder ........./models-master/research. Thanks!

it's in ./research/object_detection/packages/tf2/ read more about it here

flora992 avatar May 23 '21 00:05 flora992

!python {SCRIPTS_PATH + '/generate_tfrecord.py'} -x {IMAGE_PATH + '/train'} -l {ANNOTATION_PATH + '/label_map.pbtxt'} -o {ANNOTATION_PATH + '/train.record'} when I run this command than this error showing me Traceback (most recent call last): File "F:\Tensorflow Object Detection\Dhainik mask detection\tensorflow\scripts\generate_tfrecord.py", line 29, in from object_detection.utils import dataset_util, label_map_util ModuleNotFoundError: No module named 'object_detection'

I also try to run python setup.py build in research folder but it's not working

dhainiksuthar avatar Jun 25 '21 04:06 dhainiksuthar

!python {SCRIPTS_PATH + '/generate_tfrecord.py'} -x {IMAGE_PATH + '/train'} -l {ANNOTATION_PATH + '/label_map.pbtxt'} -o {ANNOTATION_PATH + '/train.record'} when I run this command than this error showing me Traceback (most recent call last): File "F:\Tensorflow Object Detection\Dhainik mask detection\tensorflow\scripts\generate_tfrecord.py", line 29, in from object_detection.utils import dataset_util, label_map_util ModuleNotFoundError: No module named 'object_detection'

I also try to run python setup.py build in research folder but it's not working

Hi, is your problem solved? Because I'm having the same problem and tried many ways but still couldn't solve it.

anisyaamimi avatar Jul 22 '21 17:07 anisyaamimi

https://www.codeproject.com/Articles/5130220/Make-Your-Own-Image-Classifier-On-Android-Using-Te Try to look through this or any similar articles.

If you're sure that you have installed the object_detection module, which python(2.7 or 3.0) uses it? The most of problems are related to paths because we install all libraries for python 3 but the default python 2.7 could be used by system defaults. Check your current version with command line/terminal and try to play with directories)

On Thu, Jul 22, 2021 at 8:10 PM anisyaamimi @.***> wrote:

!python {SCRIPTS_PATH + '/generate_tfrecord.py'} -x {IMAGE_PATH + '/train'} -l {ANNOTATION_PATH + '/label_map.pbtxt'} -o {ANNOTATION_PATH + '/train.record'} when I run this command than this error showing me Traceback (most recent call last): File "F:\Tensorflow Object Detection\Dhainik mask detection\tensorflow\scripts\generate_tfrecord.py", line 29, in from object_detection.utils import dataset_util, label_map_util ModuleNotFoundError: No module named 'object_detection'

I also try to run python setup.py build in research folder but it's not working

Hi, is your problem solved? Because I'm having the same problem and tried many ways but still couldn't solve it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/2543#issuecomment-885074637, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISNJAIFB4E3CSUP2ZIRAQ3TZBGG3ANCNFSM4D7PIMLA .

jaskierLTD avatar Jul 22 '21 17:07 jaskierLTD

This is probably a silly mistake on my part but I happened to have a file named object_detection.py in the same directory as the script I was running and import object_detection was trying to import that Python file. Since that file didn't have a subsequent utils module, this error showed up...

aaronjs99 avatar Jul 26 '21 12:07 aaronjs99