peace195 / tensorflow-lite-YOLOv3

YOLOv3: convert .weights to .tflite format for tensorflow lite. Convert .weights to .pb format for tensorflow serving
106 stars 24 forks source link

Does not work with tensorflow 2.0 #3

Closed peterdn1 closed 4 years ago

peterdn1 commented 4 years ago

tensorflow 2.0 slim = tf.contrib.slim module 'tensorflow' has no attribute 'contrib'

https://www.tensorflow.org/guide/migrate

A note on Slim & contrib.layers A large amount of older TensorFlow 1.x code uses the Slim library, which was packaged with TensorFlow 1.x as tf.contrib.layers. As a contrib module, this is no longer available in TensorFlow 2.0, even in tf.compat.v1. Converting code using Slim to TF 2.0 is more involved than converting repositories that use v1.layers. In fact, it may make sense to convert your Slim code to v1.layers first, then convert to Keras.

Remove arg_scopes, all args need to be explicit If you use them, split normalizer_fn and activation_fn into their own layers Separable conv layers map to one or more different Keras layers (depthwise, pointwise, and separable Keras layers) Slim and v1.layers have different arg names & default values Some args have different scales If you use Slim pre-trained models, try out Keras's pre-traimed models from tf.keras.applications or TF Hub's TF2 SavedModels exported from the original Slim code. Some tf.contrib layers might not have been moved to core TensorFlow but have instead been moved to the TF add-ons package.

peace195 commented 4 years ago

@peterdn1 Please try it on tensorflow 1.13.1 or 1.14.0. I have not tried with tensorflow 2.0

It is great if you develop a branch for tensorflow 2.0 :+1: