image-segmentation-keras icon indicating copy to clipboard operation
image-segmentation-keras copied to clipboard

module 'keras.utils' has no attribute 'get_file'

Open ranch-hands opened this issue 3 years ago • 9 comments

hello @divamgupta I WANT to run your network but as soon as I type: model = pspnet_50_ADE_20K() it shows me that error. I'm stucked pls help.

ranch-hands avatar Aug 01 '21 10:08 ranch-hands

Hey ranch! what version of tensorflow are you running? Do you load in keras separately? What worked for me is downgrading the tensorflow version, and load keras from tensorflow instead of on it's own, so:

from tensorflow import keras

Otherwise, run the code from this post below. It has all the versions of libraries pretty much guaranteed to work together. https://github.com/divamgupta/image-segmentation-keras/issues/305

SjoerdBraaksma avatar Aug 01 '21 20:08 SjoerdBraaksma

Hi, I am getting the same error while running the Google Colab (Python) notebook. PFA image.

image

Anas-Asif1996 avatar Dec 01 '21 12:12 Anas-Asif1996

Hi, I am getting the same error while running the Google Colab (Python) notebook. PFA image.

image

Same error with me. have you find some solution?

naeem9298 avatar Dec 28 '21 06:12 naeem9298

Installing the recommended version of tensorflow (tensorflow 2.4.1) and keras (2.4.3) solved this error for me. I also downgraded to python 3.6.8 on my Windows machine

bsampada7 avatar Jan 18 '22 07:01 bsampada7

Just go to the vgg16.py file and change keras.utils.get_file to tensorflow.keras.utils.get_file

sachinkmohan avatar Apr 12 '22 09:04 sachinkmohan

@sachinkmohan I tried doing this, but I'm still getting the error at line 77, in get_vgg_encoder NameError: name 'keras' is not defined. I also tried adding from tensorflow import keras. I'm using tensorflow 2.3.0 (as I dont have CUDA 11 GPU). I changed keras. calls to tensorflow.keras calls wherever applicable, and got the repo working for pre-trained model segmentations. But I'm not able to train.

Kindly help me out.

varungupta31 avatar Apr 14 '22 10:04 varungupta31

This is what I did! You can refer this. @varungupta31

https://github.com/sachinkmohan/image-segmentation-keras/pull/4/files

sachinkmohan avatar Apr 16 '22 09:04 sachinkmohan

@sachinkmohan Thank you for your inputs. I identified that the error though ending at this trace, was being caused by other issue, also I was running the command from subdir, which caused this issue (my bad).

varungupta31 avatar Apr 16 '22 18:04 varungupta31

I had same problem with vgg u-net model , This worked for me

!apt-get install -y libsm6 libxext6 libxrender-dev

!pip install opencv-python

!pip install git+https://github.com/divamgupta/image-segmentation-keras

from keras_segmentation.models.unet import vgg_unet

or check here how it's implemented https://gitee.com/sanyanjie/image-segmentation-keras

omarreess avatar Nov 21 '22 22:11 omarreess