Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectDetection API not suitable for tf 2.0.0-alpha0 #6423

Closed
theangels opened this issue Mar 22, 2019 · 70 comments
Closed

ObjectDetection API not suitable for tf 2.0.0-alpha0 #6423

theangels opened this issue Mar 22, 2019 · 70 comments
Assignees
Labels
models:research models that come under research directory

Comments

@theangels
Copy link

theangels commented Mar 22, 2019

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

@rootkitchao
Copy link

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.

@JoseLuisFriedrich
Copy link

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?

@rootkitchao
Copy link

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

@theangels
Copy link
Author

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

Oh yeah! Thanks a lot.

@austinmw
Copy link

austinmw commented Apr 4, 2019

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

@omerrciftcii
Copy link

@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

@ymodak ymodak added the models:research models that come under research directory label May 8, 2019
@ymodak ymodak assigned ymodak and pkulzc and unassigned ymodak May 8, 2019
@ymodak ymodak added the stat:awaiting model gardener Waiting on input from TensorFlow model gardener label May 8, 2019
@pkulzc
Copy link
Contributor

pkulzc commented May 8, 2019

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

@Borda
Copy link

Borda commented Jul 25, 2019

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

@yanfengliu
Copy link

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

@lucasjinreal
Copy link

@pkulzc How's the progress going?

@pkulzc
Copy link
Contributor

pkulzc commented Oct 11, 2019

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

@andreiionutdamian
Copy link

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

@enyangxxx
Copy link

enyangxxx commented Oct 12, 2019

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

@JoeSL
Copy link

JoeSL commented Nov 6, 2019

@pkulzc any updates on the migration status?

@wAikAp
Copy link

wAikAp commented Nov 7, 2019

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?

@johannesjung
Copy link

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.

@jpacifico
Copy link

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

@Borda
Copy link

Borda commented Nov 20, 2019

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

@swarupe
Copy link

swarupe commented Nov 22, 2019

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

@jpacifico
Copy link

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

@wAikAp
Copy link

wAikAp commented Nov 27, 2019

As anyone knows any other ways to train the model with TF2.0 for now situation?

@vikramg1
Copy link

I tried it and it has the same contrib error. Did anyone get it up and running successfully?

@KaneFury
Copy link

KaneFury commented Jan 8, 2020

Hey guys.. does anyone know if the object detection API was updated for TF2 and is working fine?

@gowthamkpr gowthamkpr reopened this Apr 22, 2020
@wAikAp
Copy link

wAikAp commented Apr 22, 2020

So, need how long we can use the TF2.0 object detection what do you guys think?

@alexdwu13
Copy link

@pkulzc Thanks for keeping us updated. Is there an experimental Obj Det branch we can pull from before an official update is released?

@tensorflowbutler tensorflowbutler removed the stat:awaiting model gardener Waiting on input from TensorFlow model gardener label Apr 25, 2020
@twdent
Copy link

twdent commented May 2, 2020

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

@pkulzc thanks for all your assistance. Are there any updates on this? Would be a great 1 year anniversary present for this comment :P

@davidmurray
Copy link

Also wondering when this will be updated to Tensorflow 2.0! Thanks!

@deepthiMBapat
Copy link

Hi, Currently,Which version of tf supports training on custom data set using object detection API ?

@sourangshupal
Copy link

Is there any ongoing progress?

@Samruilio
Copy link

Samruilio commented May 24, 2020

Thought tensorflow was the tool I need to begin AI study but I can't even run a tutorial code without errors :(

@haimat
Copy link

haimat commented May 24, 2020

Isn't this a real bummer for Google? I mean, there are a few mature object detection frameworks based on PyTorch (e.g. Detectron2, which is a great piece of software btw.), which seem to get more and more attention. Isn't Google risking that more and more people would switch to PyTorch if Google doesn't provide a proper and fully documented (!!) object detection framework for TF2?

Migrating to TF2 includes a number of critical issues:

* rewriting all network with keras since slim is gone
* rewriting training loop estimator which is not recommended in TF2.
* prepare new configs, new scripts, new checkpoints

Finally we have built a few TF2 models and are developing a few more latest models. The release will happen soon. Sorry for the long waiting!

@pkulzc Is there any estimation on this issue, in terms of what "soon" means? I would assume a fully working object detection framework for TF2 is one of the most anticipated features for TensorFlow these days ...

@saberkun
Copy link
Member

@jaeyounkim @pengchongjin

@hafiz031
Copy link

hafiz031 commented May 25, 2020

Looks tike there has been some progress:
https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb

how?
it works on colab but not locally? have you tried it locally?

@Masoud-Ghodrati They have also provided instructions for local installation in the same page. It might be helpful. You may check out it or can directly go from here: installation instructions. For training it locally: running locally

@RAZOR15000
Copy link

so, there is no way to train a new model with any version of tensorflow? is that it ??

@vijay0523
Copy link

It's been a few months now... Is there any update ? For contrib support in TF2>=2?

@vijay0523
Copy link

Also I cannot downgrade TF to any of the lower versions as pip shows only versions available are 2.2 , 2.2a, latest ones

@codecolony
Copy link

+1 subscriber to TF 2.0+ Object Detection API status.

@nickkimer
Copy link

sad day as I have now no choice but to return to pyTorch :(

@enragedginger
Copy link

@nickkimer Same here. I'm now porting everything off of Tensorflow.

@haimat
Copy link

haimat commented Jun 19, 2020

I would really be interested to know what Google "officially" thinks and plans about htis matter. Aren't they a bit afraid that with every week while nothing happens in this matter more and more users switch to PyTorch (or GluonCV or something else)?

@Zeldon
Copy link

Zeldon commented Jun 25, 2020

Hi guys, any news of this migration?

@jarviscodes
Copy link

Also I cannot downgrade TF to any of the lower versions as pip shows only versions available are 2.2 , 2.2a, latest ones

That's very likely because you are on python 3.8 and tf==1.15 does not support 3.8. You'll need an environment with python 3.7.6 and this should work.

@yaysummeriscoming
Copy link

Also worth noting that it's now possible to set the colab TPU tensorflow version. This means you can continue to use tensorflow 1.15 & OD API in colab:

!pip uninstall -y tensorflow
!pip install tensorflow==1.15.2

# Restart runtime here, then run:

!pip install cloud-tpu-client
from cloud_tpu_client import Client

# Check that TF version is 1.15.2
print("Tensorflow version: ", tf.__version__)

c = Client()
c.configure_tpu_version(tf.__version__, restart_type='ifNeeded')

@vinayentc
Copy link

TensorFlow Object Detection API supports both TensorFlow 2 (TF2) and TensorFlow 1 (TF1) officially now.

https://github.com/tensorflow/models/tree/master/research/object_detection

@novoforce
Copy link

Could anyone help me how to use eval_utils.py for evaluation of the training and get the mAP mIOU scores.

Object Detection automation moved this from Needs triage (Issues) to Closed Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
models:research models that come under research directory
Projects
Object Detection
  
Closed
Development

No branches or pull requests