Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import "tensorflow.keras.preprocessing.image" could not be resolvedPylancereportMissingImports

I am getting the above error in my code. I do have the python keras library installed. Can anyone pls help with this?

like image 526
Vaishnavi Avatar asked Oct 15 '25 19:10

Vaishnavi


2 Answers

It seems lint has problem to access it with the directory structure of latest releases.

Try to expand import in this way:

from tensorflow import keras
from keras._tf_keras.keras.preprocessing.image import whatever_you_want

I have tested it with latest versions and it worked.

like image 51
Silverstorm Avatar answered Oct 17 '25 10:10

Silverstorm


I changed it to -- from keras.applications import ImageDataGenerator and Voila it worked!!

like image 29
Vaishnavi Avatar answered Oct 17 '25 11:10

Vaishnavi