简体   繁体   中英

Python uses wrong Package version

Hi i try to launch the object_detection_tutorial on my PC. When i run the following code to load a (frozen) Tensorflow model into memory.

detection_graph = tf.Graph()
with detection_graph.as_default():
  od_graph_def = tf.GraphDef()
  with tf.gfile.GFile(PATH_TO_FROZEN_GRAPH, 'rb') as fid:
    serialized_graph = fid.read()
    od_graph_def.ParseFromString(serialized_graph)
    tf.import_graph_def(od_graph_def, name='')

ValueError: No op named NonMaxSuppressionV2 in defined operations.

I googled the error and upgrading the tensorflow version to 1.4 should fix the bug. In my code i used tensorflow 1.13 and it worked in google cloud. But even after uninstalling and installing eg. tensorflow 1.4, python uses 1.2.1

Picture of my code: https://ibb.co/VYkq2rF

Looks like the module is not installed correctly. Try creating a new environment using conda and set up Object Detection in it. It should resolve your issue.

Also, as best practices, it is always better to work on a conda environment than working on the base environment.

Please use below command to create an empty new environment and then install packages on it.

conda create --no-default-packages --name <env_name> python=<version>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM