Open ghost opened 7 years ago
model = SqueezeNet(weights=None, classes=2)
should be work
The new update solved the problem but now have other additional problems
import numpy as np
from keras_squeezenet import SqueezeNet
from keras.applications.imagenet_utils import preprocess_input, decode_predictions
from keras.preprocessing import image
model = SqueezeNet(weights=None, classes=2)
img = image.load_img('dog.jpg', target_size=(200, 200))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
preds = model.predict(x)
print('Predicted:', decode_predictions(preds))
Its about the image size error
ValueError: Error when checking : expected input_1 to have shape (None, 227, 227, 3) but got array with shape (1, 200, 200, 3)
I know you are not the author but thank you for the reply
@potholiday there's two solutions.
input_shape = _obtain_input_shape(input_shape, default_size=227, min_size=48, data_format=K.image_data_format(), include_top=True)
to
input_shape = _obtain_input_shape(input_shape, default_size=200, min_size=48, data_format=K.image_data_format(), include_top=True)
I think the first solution is easier
I am trying to retrain it with new classes because it doesn't have any proper docs I made many assumptions to retrain it. Basically I am trying to use it for two objects classification so i changed
nb_classes
to 2 and tried to retrain it. But its giving this errorThis is the full code