Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AirSimE2EDeepLearning TrainModel 'keras.preprocessing.image' has no attribute 'flip_axis' #88

Open
aschwarz387 opened this issue Jan 27, 2019 · 6 comments

Comments

@aschwarz387
Copy link

Problem description

AttributeError: module 'keras.preprocessing.image' has no attribute 'flip_axis'
but I can look at the object and see it.

Problem details

I solved my problems with getting past the from keras_tqdm import TQDMNotebookCallback problem, and now am stuck with a AttributeError: module 'keras.preprocessing.image' has no attribute 'flip_axis'
image
but I can see it in the code. I have added that location to path variable, and even
sys.path.insert(2,'C:\Anaconda3\envs\quadcop2019\Lib\site-packages\keras_preprocessing')
but still no success. recreated environment 3 times, today alone.

Experiment/Environment details

  • Tutorial used: (AutonomousDrivingCookbook-master\AirSimE2EDeepLearning)
  • Machine used: (Thinkpad P71 with Nvidia P3000 GPU Windows 10 Pro for Workstations )
  • Versions of artifacts used (if applicable): ()
    python 3.6.8 , keras 2.1.2 , keras-applications 1.0.6 , keras-preprocessing 1.0.5 , keras-tqdm 2.0.1
    matplotlib 2.1.2 , opencv 3.4.4 , pandas 0.24.0 , tensorflow-gpu 1.7.1 , tensorboard 1.7.0 .
    tensorflow 1.12.0 , tensorflow-base 1.12.0

sys.path
['C:\Python36',
'C:\Anaconda3\envs\quadcop2019\Lib\site-packages\keras_tqdm',
'C:\Anaconda3\envs\quadcop2019\Lib\site-packages\keras_preprocessing',
'C:\Anaconda3\envs\quadcop2019\python36.zip',
'C:\Anaconda3\envs\quadcop2019\DLLs',
'C:\Anaconda3\envs\quadcop2019\lib',
'C:\Anaconda3\envs\quadcop2019',
'C:\Anaconda3\envs\quadcop2019\lib\site-packages',
'C:\Anaconda3\envs\quadcop2019\lib\site-packages\IPython\extensions',
'C:\Users\Al\.ipython']

@mitchellspryn
Copy link
Contributor

I tried installing the package versions that you have listed, and was unable to repro. Can you import the problematic library in a fresh notebook? If not, consider opening up an issue on the repo hosting the library.

@micdahl
Copy link

micdahl commented Mar 6, 2019

Had the same problem.
Resolved it by changing
x = image.flip_axis(x, img_col_axis) to x = image.image.flip_axis(x, img_col_axis)
and
x = image.flip_axis(x, img_row_axis) to x = image.image.flip_axis(x, img_row_axis)
in Generator.py

@smartboy110
Copy link

I have the same problem. Do you have solved this problem.Thank you!

@JFrankLee
Copy link

Had the same problem.
Resolved it by changing
x = image.flip_axis(x, img_col_axis) to x = image.image.flip_axis(x, img_col_axis)
and
x = image.flip_axis(x, img_row_axis) to x = image.image.flip_axis(x, img_row_axis)
in Generator.py

thx

@antonyalexos
Copy link

I don't know if @micdahl 's solution works. But I tried adding the function source to my code.
If you see here, you can find the original code. Just take it and add it to your function. I believe that this error occurs in TF2 and afterwards, since the age of the file is old(Mar 22, 2018).

If you have a function that you use inside the flip_axis, just add the flip_axis implementation function inside that function.

TLDR add the code below to your implementation
def flip_axis(x, axis): x = np.asarray(x).swapaxes(axis, 0) x = x[::-1, ...] x = x.swapaxes(0, axis) return x

@rkuo2000
Copy link

rkuo2000 commented Nov 28, 2021

Had the same problem.
Resolved it by changing
x = image.flip_axis(x, img_col_axis) to x = image.image.flip_axis(x, img_col_axis)
and
x = image.flip_axis(x, img_row_axis) to x = image.image.flip_axis(x, img_row_axis)
in Generator.py

Thx, this fix works !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants