Python tips and tricks - 6: Fixing generic_utils error while importing segmentation models library

preview_player
Показать описание
Note: Importing segmentation models library may give you generic_utils
error on TF2.x

If you get an error about generic_utils...

change
to
in
.../lib/python3.7/site-packages/efficientnet/__init__.py

For Anaconda users:
Use this code to find out the location of site-packages directory
under your current environment in anaconda.

print(get_python_lib())

For Colab users:
You can click on the direct link provided on Colab for __init__.py and edit it.
Remember to restart the runtime after editing the file.

Alternatively you can work with Tensorflow 1.x that doesn't throw
the generic_utils error.
In google colab, add this as your first line.
%tensorflow_version 1.x
(Or just create a new environment in your local IDE to use TF1.x)

Code generated in the video can be downloaded from here:
Рекомендации по теме
Комментарии
Автор

thanks a lot for making this video, i just ran into this problem and i had no idea how could i fix it... i have been watching your videos for a while now and they really helped me a lot in understanding and implementing segmentation. thanks again

oo_wais
Автор

a simple but very useful tricks, with simple way of explanation. very nice...

vivek-ebic
Автор

This issue also occurs in Kaggle. It can be fixed by running this line:

%env SM_FRAMEWORK=tf.keras

Before this one:


!pip install segmentation-models



These two lines must be executed always at the beggining of the code. I don't know if there is another way, but it worked for me

juansebastian
Автор

Thank you so much, you are life saver.

waqascheema
Автор

Hi Sreeni, it will be great if you can please make a video on ANOGAN. There has been a challenge to detect anomalous pixels within an image by just training the normal data. Autoencoder does not work well in most cases as the lighting conditions change in manufacturing environement. May you have some other good suggestion. But I saw ANOGAN, DCGAN is answer to those question but it is hard for us to implement that algorithm with good accuracy and parameters. Thanks

umairsabir
Автор

module 'keras.utils' has no attribute 'get_file' how about this ser?

dantec.dagandanan
Автор

module 'keras.utils' has no attribute 'get_file' this is my error when I did your method it just ruined everything

XX-vujo
Автор

lol, i spend a day to convert the whole code from TF1.x to TF2.x

talha_anwar
welcome to shbcf.ru