microsoft / AutonomousDrivingCookbook

Scenarios, tutorials and demos for Autonomous Driving
MIT License
2.33k stars 569 forks source link

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

Open aschwarz387 opened 5 years ago

aschwarz387 commented 5 years ago

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

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

JFrankLee commented 4 years ago

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 commented 4 years ago

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 commented 3 years ago

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 !