3

I installed the Tensorflow Object Detection API, and ran the model_builder_test.py script to make sure everything was working. I got the following error:

AttributeError: module 'tensorflow' has no attribute 'contrib'

I'm using Python 3.7.3 and Tensorflow 2.0.0. According to this answer, it may be related to Tensorflow version 2. I'm going to use this method to upgrade the model_builder_test.py script. However, I'm worried about other issues in the Object Detection API using Tensorflow 2.

My questions are:

1) Am I correct in interpreting this error?

2) Is it safe to use Object Detection with Tensorflow 2, or should I downgrade to Tensorflow 1.x?

Thanks!

cd_warman
  • 83
  • 5
  • 1
    Its better to use Tensorflow 1.x for object detection API. Even if you upgrade code automatically, there may be issues moving forward. Or you can wait until Tensorflow object detection API is upgraded to TF 2.0 compatible. – xanjay Nov 02 '19 at 16:27

1 Answers1

2

1) Yes

2) Yes, and it may in fact work better per several bug fixes in TF2 - but make sure you follow the linked guide closely to confirm model behavior doesn't change unexpectedly (i.e. compare execution in TF1 vs. TF2)

However; the "make sure" in (2) is easier said than done - we're talking about an entire API here. This is best left to the API's devs themselves, unless you're highly familiar with relevant parts of the repository. Even if you fix one bug, there may be others, even those that don't throw errors, per class/method-based functionality changes (especially in Eager vs. Graph interactions). There's not much harm to using TF 1.x, and it may even run faster.

Lastly, I'd suggest opening a TF Git issue on this; contributors/devs may respond there & not here.

OverLordGoldDragon
  • 1
  • 9
  • 53
  • 101