SyntaxError: invalid syntax, python3 in models/research/object_detection/utils/object_detection_evaluation.py
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
I got same error running on python3, solved switching to python2 env.
switch to python 2 or simply add parentheses to the print function.
This PR fixes the bug:
https://github.com/tensorflow/models/pull/4823
You can use "2to3.py -w object_detection_evaluation.py" to fix this problem
I got the same error running python3. Solved fixing parentheses.
Closing as this is resolved
File "eval.sh", line 4 for file in ./models/989999.npy ^ SyntaxError: invalid syntax