Closed pbalapra closed 7 years ago
Hi, @pbalapra!
My bad! I updated the API without updating the README. Here is an example of the new API:
>>> import keras
>>> import keras_resnet
>>> shape, classes = (32, 32, 3), 10
>>> x = keras.layers.Input(shape)
>>> y = keras_resnet.ResNet50(x)
>>> y = keras.layers.Flatten()(y.output)
>>> y = keras.layers.Dense(classes)(y)
>>> model = keras.models.Model(x, y)
>>> model.compile("adam", "categorical_crossentropy", ["accuracy"])
>>> (training_x, training_y), (_, _) = keras.datasets.cifar10.load_data()
>>> training_y = keras.utils.np_utils.to_categorical(training_y)
>>> model.fit(training_x, training_y)
Let me know if you need any additional help!
@0x00b1 Allen, thanks a lot for fixing. I still have an error:
Traceback (most recent call last):
File "resnet.py", line 13, in
Traceback (most recent call last):
File "resnet.py", line 13, in
Hi, @pbalapra! I made a small typo. Here is the updated example:
>>> import keras
>>> import keras_resnet
>>> shape, classes = (32, 32, 3), 10
>>> x = keras.layers.Input(shape)
>>> y = keras_resnet.ResNet50(x)
>>> y = keras.layers.Flatten()(y.output)
>>> y = keras.layers.Dense(classes)(y)
>>> model = keras.models.Model(x, y)
>>> model.compile("adam", "categorical_crossentropy", ["accuracy"])
>>> (training_x, training_y), (_, _) = keras.datasets.cifar10.load_data()
>>> training_y = keras.utils.np_utils.to_categorical(training_y)
>>> model.fit(training_x, training_y)
Let me know!
import keras_resnet.models import keras
shape, classes = (32, 32, 3), 10
x = keras.layers.Input(shape)
print(x)
model = keras_resnet.ResNet50(x) model.summary() model.compile("adam", "categorical_crossentropy", ["accuracy"])
(x, y), (, ) = keras.datasets.cifar10.load_data()
y = keras.utils.np_utils.to_categorical(y)
model.fit(x, y) +++++++++++++++++++++++++++++++++ I ran the above test code in Python 2.7.9 and but I got:
ValueError: Error when checking model target: expected average_pooling2d_1 to have 4 dimensions, but got array with shape (50000, 10)