-
Notifications
You must be signed in to change notification settings - Fork 308
SciPy for image transformations #87
Comments
This is the line: |
Thank you very much for reporting this issue. Could you please provide a reproducible test case, so we can investigate this issue locally? |
@anna-tikhonova I created my x and y's in kaggle, since I thought it would be easier to do so and not try to install sklearn and other things. This generates a pickle file, and you can download it in the output: import numpy as np
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.models import Sequential
from tensorflow.keras.optimizers import Adam, SGD
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.regularizers import l2
from tensorflow.keras.layers import Conv2D, Dropout, Dense, Flatten, BatchNormalization, AveragePooling2D
import pickle
import gc
data = []
data = pickle.load(open("pickle.dat", "rb"))
x_train = data[0]
x_val = data[1]
y_train = data[2]
y_val = data[3]
print('datagen')
datagen = ImageDataGenerator(
rescale=1.0/255.0,
zoom_range = 0.1,
shear_range=0.1,
fill_mode = "reflect",
vertical_flip=True,
width_shift_range = 0.1,
height_shift_range = 0.1,
)
print('datagen_fit')
#datagen.fit(x_train) <-- # Commented out for some purposes
valgen = ImageDataGenerator(
rescale=1.0/255.0
)
gc.collect()
print('model')
model = Sequential()
model.add(Conv2D(6, kernel_size=(5, 5), strides=(1, 1), activation='relu', input_shape=(150, 150, 3), padding='same'))
model.add(AveragePooling2D(pool_size=(2, 2), strides=(1, 1), padding='valid'))
model.add(BatchNormalization())
model.add(Dropout(0.27))
model.add(Conv2D(16, kernel_size=(5, 5), strides=(1, 1), activation='relu', padding='valid'))
model.add(AveragePooling2D(pool_size=(2, 2), strides=(2, 2), padding='valid'))
model.add(BatchNormalization())
model.add(Dropout(0.27))
model.add(Conv2D(120, kernel_size=(5, 5), strides=(1, 1), activation='relu', padding='valid'))
model.add(Flatten())
model.add(Dense(84, activation='relu'))
model.add(Dense(38, activation='softmax'))
print('Model compile')
model.compile(loss='categorical_crossentropy', optimizer=SGD(lr=0.01, nesterov=True), metrics=['accuracy'])
print('Model fit')
model.fit_generator(datagen.flow(x_train,y_train,batch_size=8, shuffle=True), epochs=30, shuffle=True, steps_per_epoch=x_train.shape[0]//8, validation_data=valgen.flow(x_val,y_val,batch_size=8, shuffle=True), verbose=2) I'm new to ML and deep learning, so this is not a great model. The error again is at Note that I tried to download SciPy through brew, which was under the Rosetta 2 emulation, and it worked. But the thing is, tensorflow wasn't native, so that would be useless. And also, I tried installing SciPy through native brew, which threw me a bunch of errors. |
The README.md says that scipy isn't available, so I was wondering if I could avoid doing these things. (Image transformations) |
I was able to compile scipy from source for python 3.8 to run native. I haven't tested it thoroughly but I confirmed it did load correctly. |
Followup, I copied and pasted the code above, and it seems kinda slow but it does run:
|
Yeah, how did you get it to run? For some reason it is slow, I wonder if it's just the model or ML isn't for macs. |
Same problem
|
Have the same problem |
I'm running into the same problem with a code I wrote... Did anyone find a solution yet? |
same problem! |
But for mine, the model.fit would work in my other scripts. But not on this one script where I got data from kaggle. does it have anything to do with kaggle? |
Same problem here. I installed scipy via pip but didn't work. I think the problem lies inside ImageDataGenerator |
Same error!!!how to solve it? |
I am having the same issue after using cx_freeze |
Same error here. The first time I'm training a model though so there is definitely a possibility that I did something wrong. |
Hi, well I could fix it. Normally I opened Visual Studio to run a python script since my desktop, but when I open Visual Studio since 'search' from windows this problem about 'scipy' does not exist. |
I'm trying to train a model which works on kaggle, but won't work on my M1 macbook pro. It says:
ImportError: Image transformations require SciPy. Install SciPy
I just built a model to identify plants and diseases, but the problem is that it isn't working when it's fitting. Compiling is fine, but it stops and gives me errors when the model tries to fit.
The text was updated successfully, but these errors were encountered: