Models: tf.contrib.slim is not worked in tensorflow 2.0 what is the alternative for that?

Created on 9 Jan 2020  Â·  8Comments  Â·  Source: tensorflow/models

Please go to Stack Overflow for help and support:

http://stackoverflow.com/questions/tagged/tensorflow

Also, please understand that many of the models included in this repository are experimental and research-style code. If you open a GitHub issue, here is our policy:

  1. It must be a bug, a feature request, or a significant problem with documentation (for small docs fixes please send a PR instead).
  2. The form below must be filled out.

Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.


System information

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

You can collect some of this information using our environment capture script:

https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh

You can obtain the TensorFlow version with

python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

Describe the problem

Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.

Source code / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.

research support

Most helpful comment

hi again it is giving the following error

import tf_slim as slim
File "/usr/local/lib/python3.6/dist-packages/tf_slim/__init__.py", line
23, in
from tf_slim import evaluation
File "/usr/local/lib/python3.6/dist-packages/tf_slim/evaluation.py", line
131, in
from tensorflow.contrib.training.python.training import evaluation
ModuleNotFoundError: No module named 'tensorflow.contrib'

On Thu, Jan 9, 2020 at 12:35 PM Hongkun Yu notifications@github.com wrote:

https://github.com/google-research/tf-slim
Slim has a mirror outside TF now. To use it with TF2 in compatible mode,
you should install it as a package.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/models/issues/8020?email_source=notifications&email_token=AKDKCK6KZDAIT7OXNJCJAZDQ46DCLA5CNFSM4KEVSUJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRV5UY#issuecomment-572743379,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKDKCK55JV5GLWAT57SYM63Q46DCLANCNFSM4KEVSUJQ
.

All 8 comments

https://github.com/google-research/tf-slim
Slim has a mirror outside TF now. To use it with TF2 in compatible mode, you should install it as a package.

hi again it is giving the following error

import tf_slim as slim
File "/usr/local/lib/python3.6/dist-packages/tf_slim/__init__.py", line
23, in
from tf_slim import evaluation
File "/usr/local/lib/python3.6/dist-packages/tf_slim/evaluation.py", line
131, in
from tensorflow.contrib.training.python.training import evaluation
ModuleNotFoundError: No module named 'tensorflow.contrib'

On Thu, Jan 9, 2020 at 12:35 PM Hongkun Yu notifications@github.com wrote:

https://github.com/google-research/tf-slim
Slim has a mirror outside TF now. To use it with TF2 in compatible mode,
you should install it as a package.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/models/issues/8020?email_source=notifications&email_token=AKDKCK6KZDAIT7OXNJCJAZDQ46DCLA5CNFSM4KEVSUJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRV5UY#issuecomment-572743379,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKDKCK55JV5GLWAT57SYM63Q46DCLANCNFSM4KEVSUJQ
.

All contrib usage need to go away.
If you are using object detection api and models other than official models, maintainers may not upgrade to TF2 symbols. Please contact the code owners to know the status.

I had a similar error when importing evaluation. Go to "https://github.com/google-research/tf-slim/tree/master/tf_slim" and download evaluation.py in some directory and include that directory in your path. That solved the error for me

Hi dragonsan17, could you elaborate how do you replace eval_util.py with evaluation.py in tf_slim? I don't think they are equivalent, are they? I got stuck between tf-1.5 and tf-2.1: if run in tf-1.5, I have "compat.v1" issue, and if run in tf-2.1, I have "no contrib" issue. I am highly interested on how do you solve the 'no contrib' issue running in tf-2.1. Thanks in advance for your help.

The link I mentioned above contains files which you can assume to be inside "tf.contrib.python". And then you can import training.evaluation from it

@sreenupadidapu

Is this still an issue?. Please, close this thread if your issue was resolved.Thanks!

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings