models icon indicating copy to clipboard operation
models copied to clipboard

SyntaxError: invalid syntax, python3 in models/research/object_detection/utils/object_detection_evaluation.py

Open gopalkildoliya opened this issue 8 years ago • 7 comments

System information

  • What is the top-level directory of the model you are using: model/research/object_detection
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): v1.8.0
  • Bazel version (if compiling from source):
  • CUDA/cuDNN version: cuda-9.0
  • GPU model and memory: 1080ti / 12G
  • Exact command to reproduce: python3 eval.py

Python3 SyntaxError: invalid syntax

While running eval.py I am facing the syntax error with python3. Seems to be probles with last updates.

https://github.com/tensorflow/models/blob/b07b494e3514553633b132178b4c448f994d59df/research/object_detection/utils/object_detection_evaluation.py#L842-L844

Source code / logs

   Traceback (most recent call last):
  File "eval.py", line 8, in <module>
    from object_detection import evaluator
  File "/work/7_tfdet/models/research/object_detection/evaluator.py", line 24, in <module>
    from object_detection import eval_util
  File "/work/7_tfdet/models/research/object_detection/eval_util.py", line 28, in <module>
    from object_detection.metrics import coco_evaluation
  File "/work/7_tfdet/models/research/object_detection/metrics/coco_evaluation.py", line 21, in <module>
    from object_detection.utils import object_detection_evaluation
  File "/work/7_tfdet/models/research/object_detection/utils/object_detection_evaluation.py", line 842
    print 'Scores and tpfp per class label: {}'.format(class_index)
                                              ^
SyntaxError: invalid syntax

gopalkildoliya avatar Jul 16 '18 09:07 gopalkildoliya

I got same error running on python3, solved switching to python2 env.

RomRoc avatar Jul 16 '18 11:07 RomRoc

switch to python 2 or simply add parentheses to the print function.

netanel-s avatar Jul 16 '18 13:07 netanel-s

This PR fixes the bug:

https://github.com/tensorflow/models/pull/4823

gar1t avatar Jul 18 '18 20:07 gar1t

You can use "2to3.py -w object_detection_evaluation.py" to fix this problem

SanderCEI avatar Jul 19 '18 01:07 SanderCEI

I got the same error running python3. Solved fixing parentheses.

xtianhb avatar Jul 25 '18 16:07 xtianhb

Closing as this is resolved

wt-huang avatar Nov 03 '18 01:11 wt-huang

File "eval.sh", line 4 for file in ./models/989999.npy ^ SyntaxError: invalid syntax

NNaqvi avatar Mar 29 '19 04:03 NNaqvi