models icon indicating copy to clipboard operation
models copied to clipboard

ObjectDetection API not suitable for tf 2.0.0-alpha0

Open theangels opened this issue 7 years ago • 70 comments

System information

  • What is the top-level directory of the model you are using: /Appendix/tensorflow_models/research
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Nope
  • 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): 2.0.0-alpha0, and the models lib clone on Mar 11, 2019
  • Bazel version (if compiling from source):
  • CUDA/cuDNN version: 10.0
  • GPU model and memory: 1050Ti
  • Exact command to reproduce: PIPELINE_CONFIG_PATH='/home/jovyan/Codelab/model/pipeline.config' MODEL_DIR='/home/jovyan/Codelab/data' NUM_TRAIN_STEPS=50000 SAMPLE_1_OF_N_EVAL_EXAMPLES=1 python3 object_detection/model_main.py
    --pipeline_config_path=${PIPELINE_CONFIG_PATH}
    --model_dir=${MODEL_DIR}
    --num_train_steps=${NUM_TRAIN_STEPS}
    --sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES
    --alsologtostderr

tf_upgrade_v2 --intree . --outtree . --copyotherfiles False

Describe the problem

I try to use ObjectDetection API in TensorFlow 2.0.0-alpha0, but the program told me that AttributeError: module 'tensorflow' has no attribute 'contrib', clearly Google has delete the contrlib library. So next step I try to use the tf_upgrade_v2 utility to help me converting existing TensorFlow 1.x Python scripts to TensorFlow 2.0. But finally I failed. Here are the message from terminal.

Source code / logs

snipaste20190322_205738

@wangtz

theangels avatar Mar 22 '19 12:03 theangels

The current version of the object detection API requires Tensorflow 1.X (>1.12).Because the current version requires contrib.slim, which was removed in Tensorflow 2.0.

rootkitchao avatar Mar 22 '19 17:03 rootkitchao

The current version of the object detection API requires Tensorflow 1.X (>1.12).Because the current version requires contrib.slim, which was removed in Tensorflow 2.0.

Is there any date or plan in the future to migrate it to 2.0?

JoseLuisFriedrich avatar Mar 25 '19 11:03 JoseLuisFriedrich

I don't know the specific situation.But the object detection API will be updated to Tensorflow 2.0.

rootkitchao avatar Mar 25 '19 20:03 rootkitchao

I don't know the specific situation.But the object detection API will be updated to Tensorflow 2.0.

Oh yeah! Thanks a lot.

theangels avatar Mar 26 '19 07:03 theangels

@rootkitchao Any idea what the timeline for that is? Just curious, I know it will likely require a lot of work.

austinmw avatar Apr 04 '19 19:04 austinmw

@rootkitchao Any idea what the timeline for that is? Just curious, I know it will likely require a lot of work.

did you find something? I cant use train.py, it still giving this error: "AttributeError: module 'tensorflow' has no attribute 'contrib' "

I tried to use model_main.py but nothing changes. I don't know what should I do

omerrciftcii avatar Apr 26 '19 19:04 omerrciftcii

We are collaborating with TF team to migrate to 2.0 now, but this is a huge effort which may take months.

pkulzc avatar May 08 '19 22:05 pkulzc

Any update on the actual status of migration to TF 2.0? Are there some particular actions/points that the community may be helpful?

Borda avatar Jul 25 '19 21:07 Borda

@omerrciftcii I think your best option right now is to just create a virtual env with tensorflow 1.x

yanfengliu avatar Aug 09 '19 18:08 yanfengliu

@pkulzc How's the progress going?

lucasjinreal avatar Oct 09 '19 09:10 lucasjinreal

We've made some progress but are still not ready for full migration or release.

pkulzc avatar Oct 11 '19 05:10 pkulzc

@pkulzc thank you for the update! Maybe some kind of work-around in the mean time?

andreiionutdamian avatar Oct 11 '19 05:10 andreiionutdamian

while having tf 2.0.0: how to handle "module 'tensorflow' has no attribute 'GraphDef' "?

enyangxxx avatar Oct 12 '19 11:10 enyangxxx

@pkulzc any updates on the migration status?

JoeSL avatar Nov 06 '19 16:11 JoeSL

I used model_main.py in TF2.0 with the same problem. Traceback (most recent call last): File "model_main.py", line 26, in from object_detection import model_lib File "../object_detection/model_lib.py", line 27, in from object_detection import eval_util File "../object_detection/eval_util.py", line 40, in slim = tf.contrib.slim AttributeError: module 'tensorflow' has no attribute 'contrib'

I tried to use the tf_upgrade_v2 cmd to the eval_util.py and model_main.py its doesn't work. Although I know this behavior is not scientific. BTW, any update for object detection in TF2.0?

wAikAp avatar Nov 07 '19 12:11 wAikAp

I used model_main.py in TF2.0 with the same problem. Traceback (most recent call last): File "model_main.py", line 26, in from object_detection import model_lib File "../object_detection/model_lib.py", line 27, in from object_detection import eval_util File "../object_detection/eval_util.py", line 40, in slim = tf.contrib.slim AttributeError: module 'tensorflow' has no attribute 'contrib'

I tried to use the tf_upgrade_v2 cmd to the eval_util.py and model_main.py its doesn't work. Although I know this behavior is not scientific. BTW, any update for object detection in TF2.0?

Until the Object Detection API is updated to TensorFlow 2 simply use TensorFlow 1.15 (pip install tensorflow==1.15). It still contains contrib and also a complete implementation of the 2.0 API. Using the compat.v2 module you can already ensure that your code (except for the Object Detection API part of course) will work with 2.0. Check the TensorFlow 1.15 release notes for further information.

johannesjung avatar Nov 07 '19 13:11 johannesjung

hi, how's the progress going? Is it now possible to use Object Detection API with TF 2.0 ?

jpacifico avatar Nov 20 '19 14:11 jpacifico

@jpacifico I guess it is already released... https://github.com/tensorflow/models/releases/tag/v2.0

Borda avatar Nov 20 '19 14:11 Borda

Object Detection API is not yet released with TF 2.0 I guess

swarupe avatar Nov 22 '19 11:11 swarupe

Object Detection API is not yet released with TF 2.0 I guess

yes I guess too, still have the same 'contrib' error with TF 2

jpacifico avatar Nov 22 '19 11:11 jpacifico