EdjeElectronics / TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

How to train a TensorFlow Object Detection Classifier for multiple object detection on Windows
Apache License 2.0
2.92k stars 1.3k forks source link

TypeError: non_max_suppression() got an unexpected keyword argument 'score_threshold' #133

Open leekwunfung817 opened 6 years ago

leekwunfung817 commented 6 years ago

(base) C:\windows\system32>pip install -I tensorflow-gpu==1.5 Collecting tensorflow-gpu==1.5 Using cached https://files.pythonhosted.org/packages/26/1e/067fa5a334df570f7ea060450585568d9d4e3847f85dcf01f4ecc9c6814f/tensorflow_gpu-1.5.0-cp36-cp36m-win_amd64.whl Collecting wheel>=0.26 (from tensorflow-gpu==1.5) Using cached https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl Collecting six>=1.10.0 (from tensorflow-gpu==1.5) Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl Collecting protobuf>=3.4.0 (from tensorflow-gpu==1.5) Using cached https://files.pythonhosted.org/packages/e8/df/d606d07cff0fc8d22abcc54006c0247002d11a7f2d218eb008d48e76851d/protobuf-3.6.1-cp36-cp36m-win_amd64.whl Collecting absl-py>=0.1.6 (from tensorflow-gpu==1.5) Collecting tensorflow-tensorboard<1.6.0,>=1.5.0 (from tensorflow-gpu==1.5) Using cached https://files.pythonhosted.org/packages/cc/fa/91c06952517b4f1bc075545b062a4112e30cebe558a6b962816cb33efa27/tensorflow_tensorboard-1.5.1-py3-none-any.whl Collecting numpy>=1.12.1 (from tensorflow-gpu==1.5) Downloading https://files.pythonhosted.org/packages/fb/7d/f8b97d97809f184d90faf320fa8e2e7eac994844c5e6c57adbed1283e9e9/numpy-1.15.1-cp36-none-win_amd64.whl (13.5MB) 100% |████████████████████████████████| 13.5MB 2.2MB/s Collecting setuptools (from protobuf>=3.4.0->tensorflow-gpu==1.5) Downloading https://files.pythonhosted.org/packages/66/e8/570bb5ca88a8bcd2a1db9c6246bb66615750663ffaaeada95b04ffe74e12/setuptools-40.2.0-py2.py3-none-any.whl (568kB) 100% |████████████████████████████████| 573kB 6.6MB/s Collecting werkzeug>=0.11.10 (from tensorflow-tensorboard<1.6.0,>=1.5.0->tensorflow-gpu==1.5) Using cached https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl Collecting bleach==1.5.0 (from tensorflow-tensorboard<1.6.0,>=1.5.0->tensorflow-gpu==1.5) Using cached https://files.pythonhosted.org/packages/33/70/86c5fec937ea4964184d4d6c4f0b9551564f821e1c3575907639036d9b90/bleach-1.5.0-py2.py3-none-any.whl Collecting html5lib==0.9999999 (from tensorflow-tensorboard<1.6.0,>=1.5.0->tensorflow-gpu==1.5) Collecting markdown>=2.6.8 (from tensorflow-tensorboard<1.6.0,>=1.5.0->tensorflow-gpu==1.5) Using cached https://files.pythonhosted.org/packages/6d/7d/488b90f470b96531a3f5788cf12a93332f543dbab13c423a5e7ce96a0493/Markdown-2.6.11-py2.py3-none-any.whl distributed 1.21.8 requires msgpack, which is not installed. Installing collected packages: wheel, six, setuptools, protobuf, absl-py, numpy, werkzeug, html5lib, bleach, markdown, tensorflow-tensorboard, tensorflow-gpu Successfully installed absl-py-0.4.0 bleach-1.5.0 html5lib-0.9999999 markdown-2.6.11 numpy-1.15.1 protobuf-3.6.1 setuptools-40.2.0 six-1.11.0 tensorflow-gpu-1.5.0 tensorflow-tensorboard-1.5.1 werkzeug-0.14.1 wheel-0.31.1

`(base) C:\windows\system32>python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config python: can't open file 'legacy/train.py': [Errno 2] No such file or directory

(base) C:\windows\system32> (base) C:\windows\system32>cd C:\tensorflow1\models\research\object_detection

(base) C:\tensorflow1\models\research\object_detection>python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\h5py__init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters WARNING:tensorflow:From C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\platform\app.py:124: main (from main__) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. WARNING:tensorflow:From C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\legacy\trainer.py:265: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version. Instructions for updating: Please switch to tf.train.create_global_step WARNING:tensorflow:num_readers has been reduced to 1 to match input file shards. INFO:tensorflow:Scale of 0 disables regularizer. INFO:tensorflow:Scale of 0 disables regularizer. INFO:tensorflow:depth of additional conv before box predictor: 0 Traceback (most recent call last): File "legacy/train.py", line 184, in tf.app.run() File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\platform\app.py", line 124, in run _sys.exit(main(argv)) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\util\deprecation.py", line 136, in new_func return func(*args, *kwargs) File "legacy/train.py", line 180, in main graph_hook_fn=graph_rewriter_fn) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\legacy\trainer.py", line 290, in train clones = model_deploy.create_clones(deploy_config, model_fn, [input_queue]) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\slim-0.1-py3.6.egg\deployment\model_deploy.py", line 193, in create_clones File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\legacy\trainer.py", line 203, in _create_losses prediction_dict = detection_model.predict(images, true_image_shapes) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 680, in predict self._anchors.get(), image_shape, true_image_shapes)) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 767, in _predict_second_stage anchors, image_shape_2d, true_image_shapes) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 1234, in _postprocess_rpn clip_window=clip_window) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\core\post_processing.py", line 402, in batch_multiclass_non_max_suppression parallel_iterations=parallel_iterations) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\utils\shape_utils.py", line 228, in static_or_dynamic_map_fn return tf.map_fn(fn, elems, dtype, parallel_iterations, back_prop) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\ops\functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2662, in _BuildLoop body_result = body(packed_vars_for_body) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\tensorflow\python\ops\functional_ops.py", line 399, in compute packed_fn_values = fn(packed_values) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\core\post_processing.py", line 378, in _single_image_nms_fn additional_fields=per_image_additional_fields) File "C:\ProgramData\Anaconda3.5.2.0\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\core\post_processing.py", line 150, in multiclass_non_max_suppression score_threshold=score_thresh) TypeError: non_max_suppression() got an unexpected keyword argument 'score_threshold'`

stiangus commented 6 years ago

Getting the same error when trying to export the inference graph. Like umeshsati54 said in another thread, updating to TF 1.9 works. Make sure to type specific version, as 1.10 version seems to have some issues.

pip install --upgrade tensorflow==1.9 and pip install --upgrade tensorflow-gpu==1.9

ramubonkuri commented 5 years ago

Even after updating to tensorflow 1.9 same error

KasunSandaras commented 5 years ago

This error came for me and worked after installing tensorflow-gpu 1.9 with python 3.6. didn't work with tf 1.7

nadernmds commented 5 years ago

I have the same problem please somebody help us