models icon indicating copy to clipboard operation
models copied to clipboard

object_detection_tutorial comparison tf.__version__ < '1.4.0' for version 1.10.0

Open gabrielpolyy opened this issue 8 years ago • 3 comments

Minor stuff, Context: models/research/object_detection/object_detection_tutorial

if tf.__version__ < '1.4.0':
  raise ImportError('Please upgrade your tensorflow installation to v1.4.* or later!')

Issue: However, if tf.__version__ is '1.10.0' '1.10.0' < '1.4.0' => True, which will raise ImportError even if 1.10.0 is higher.

gabrielpolyy avatar Aug 12 '18 10:08 gabrielpolyy

Delete the if case. Thats how i fixed mine :)

mutantmassXXX avatar Aug 12 '18 11:08 mutantmassXXX

the check is performed on strings, instead of ints... which is causing a failure with comparing the '4' and '10'.

I'm sure there is a more elegant solution... but you could use:

MIN_TF_VERSION_MAJOR = 1
MIN_TF_VERSION_MINOR = 9
tf_ver = [int(s) for s in tf.__version__.split('.')]

if tf_ver[0] < MIN_TF_VERSION_MAJOR or (tf_ver[0] == MIN_TF_VERSION_MAJOR and tf_ver[1] < MIN_TF_VERSION_MINOR):
  raise ImportError('Please upgrade your tensorflow installation to v{0}.{1}.* or later!'.format(MIN_TF_VERSION_MAJOR, MIN_TF_VERSION_MINOR))

dcyoung avatar Aug 13 '18 17:08 dcyoung

Closing as this is resolved

wt-huang avatar Nov 18 '18 00:11 wt-huang