[英]Layer Counting with Keras Deep Learning
I am working on my First deep-learning project on counting layers in an image with convolutional neural network. 我正在做我的第一个深度学习项目,该项目使用卷积神经网络对图像中的层进行计数。
After fixing tons of errors, I could finally train my model. 解决了很多错误之后,我终于可以训练我的模型了。 However, I am getting 0 accuracy; 但是,我得到0精度; after 2nd epoch it just stops because it is not learning anything. 在第二个时期之后,它停止了,因为它没有学习任何东西。
Input will be a 1200 x 100 size image of layers and output will be an integer. 输入将是1200 x 100大小的图层图像,输出将是整数。
If anyone can look over my model and can suggest a tip. 如果有人可以查看我的模型并提出建议。 That will be awesome. 那太好了。
Thanks. 谢谢。
from keras.layers import Reshape, Conv2D, MaxPooling2D, Flatten
model = Sequential()
model.add(Convolution2D(32, 5, 5, activation='relu', input_shape=(1,1200,100)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(64, 5, 5, activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(1, activation='relu'))
batch_size = 1
epochs = 10
sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(sgd, loss='poisson', metrics=['accuracy'])
earlyStopping=keras.callbacks.EarlyStopping(monitor='val_loss', patience=0, verbose=0, mode='auto')
history = model.fit(xtrain, ytrain, batch_size=batch_size, nb_epoch=epochs, validation_data=validation, callbacks=[earlyStopping], verbose=1)
There are sooo many thing to criticise? 有很多东西要批评吗?
Your data isn't actually big, it should work, probably your problem is at normalization of your output/inputs, check for them. 您的数据实际上并不大,它应该可以工作,可能您的问题在于输出/输入的规范化,请检查它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.