SpecAugment
SpecAugment copied to clipboard
ModuleNotFoundError when importing
ModuleNotFoundError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/specAugment/spec_augment_tensorflow.py in
ModuleNotFoundError: No module named 'tensorflow.contrib'
this code is using an older version of tensorflow, here are some edits i made to spec_augment_tensorflow.py to make it compatible with tensorflow 2.9.1:
change line 40 import statement "import tensorflow as tf" to "import tensorflow.compat.v1 as tf" change line 41 import statement "from tensorflow.contrib.image import sparse_image_warp" to "from tensorflow_addons.image import sparse_image_warp"
This still threw an error about "eager execution" wrt the "placeholder" function when trying to run the "spec_augment" function. I fixed it by inserting the command "tf.disable_eager_execution" on line 75 before the call of the placeholder function.