Open Nestak2 opened 4 years ago
A stackexchange user gave me the advice:
You modified the files in the keras_preprocessing package, but you are probably importing keras.preprocessing, which is a different package. This is fine, keras.preprocessing just forwards all calls to keras_preprocessing.
So what you need to do is to also make your modifications to the keras/preprocessing/image.py files inside the keras package, as shown here
So, I also inserted my new variable zca_whitening_fast
into keras/preprocessing/image.py
, but the same error appears :( Do I need to update something? And is there a way to trace from what file comes this error message TypeError: __init__() got an unexpected keyword argument 'zca_whitening_fast'
?
I think you should inherit ImageDataGenerator and apply your modifications in the child class.
I am using
keras=2.3.1
and I wanted to use my own version of zca_whitening. For that I made changes directly into theImageDataGenerator
class in the keras file/home/user/.local/lib/python3.6/site-packages/keras_preprocessing/image/image_data_generator.py
. The file, including my changes is this one. My neural network filenn_script.py
that uses this alteredimage_data_generator.py
can be seen here. There are no problems, as long asnn_script.py
uses the default keras augmentaions like:But if I decide to switch on my custom version of zca_whitening called
zca_whitening_fast
in this wayI get the error message
You can reproduce my error message by substituting your
image_data_generator.py
file with the one I post above and trying to create a generator with the optionzca_whitening_fast=True
.First I thought the problem is, that I have forgotten to include
zca_whitening_fast
indef __init__()
in the fileimage_data_generator.py
, but it is there, as you can check. I also tried deleting the__pycache__
folder, because I thought, that some older files are getting executed in this folder, but the same error appeared. Now I wonder if the error message comes from an__init__()
that is in a different file, not inimage_data_generator.py
. I think the solution is something obvious, I probably need to make a change in another file in the keras preprocessing folder, but I don't know which. I don't think the problem is because my keras version is old and because of compatibility reasons with my graphic card I can't upgrade keras.Any ideas why I get this error message? Thanks