Comments (5)
I think issue seems to be at line no. 79
if stride_width > 1 or stride_height > 1 or not equal_channels:
shortcut = Convolution2D(nb_filter=residual._keras_shape[1], nb_row=1, nb_col=1,
subsample=(stride_width, stride_height),
init="he_normal", border_mode="valid")(input)
Subsampling size in shortcut should be (1,1).
from keras-resnet.
Can you post a gist of what you are trying? Are you having issues running the current code? If you are using python3, try from future import division
from keras-resnet.
Hi @raghakot ,
I am just using the given example with cifar10 dataset. While running I get the following error:
Stride should be less than or equal to filter size.
I tried debugging the code:
in your bottleneck function you apply convolution of 1x1.
conv_1_1 = _bn_relu_conv(nb_filters, 1, 1, subsample=init_subsample)(input)
This works fine for the first layer but after that for other layers
init_subsample = (2, 2) (line number 93)
Here you are applying convolution of 1x1 with stride of 2.
This seems to create an error.
from keras-resnet.
cifar 10 has input shape of 2, 32, 32. The example works on 3, 224, 224.
You would need to change that. Also, you cannot has as many layers because conv and pooling layers reduce size.
Do you have a gist i can look at? Here is the modified example for cifar 10:
def resnet_cifar10():
input = Input(shape=(3, 32, 32))
conv1 = _conv_bn_relu(nb_filters=32, nb_row=3, nb_col=3, subsample=(2, 2))(input)
pool1 = MaxPooling2D(pool_size=(3, 3), strides=(2, 2), border_mode="same")(conv1)
# Build residual blocks..
block_fn = _basic_block
n = 2
block1 = _residual_block(block_fn, nb_filters=32, rep=2 * n, is_first_layer=True)(pool1)
block2 = _residual_block(block_fn, nb_filters=16, rep=2 * n)(block1)
block3 = _residual_block(block_fn, nb_filters=8, rep=2 * n)(block2)
# Classifier block
pool2 = AveragePooling2D(pool_size=(7, 7), strides=(1, 1), border_mode="same")(block3)
flatten1 = Flatten()(pool2)
dense = Dense(output_dim=10, init="he_uniform", activation="softmax")(flatten1)
model = Model(input=input, output=dense)
return model
I think I will implement a class to handle building various configurations of resnet to avoid these kind of issues.
from keras-resnet.
I updated the code to include ResNetBuilder factory class. You can now build your own resnet architecture with variable input sizes and layers
from keras-resnet.
Related Issues (20)
- Should we watch val_loss or val_acc in callbacks? HOT 2
- Spec requirement for running resnet152 HOT 1
- Model cannot add original to filtered data.
- Error CNTK
- Training loss reduces sooo slow
- image prediction HOT 2
- possible bug between residual unit and shortcut HOT 1
- Last layer activation HOT 1
- TimeDistributed wrapping causing issues
- about data provider HOT 1
- Stuck in first epoch
- Where is the model saved? HOT 2
- inference image preprocessing HOT 1
- Merging before BM and Pool__resnet50
- TypeError: __init__() takes at least 4 arguments (1 given)
- Problem of funtion _shortcut HOT 1
- Why Conv2_1 has stride of (1,1)?
- Some questions about feature map size matching.
- AttributeError: module 'resnet' has no attribute 'ResnetBuilder' HOT 2
- Why does epochs stop at 56 times?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras-resnet.