对于 500*500*3 图像,我应该为 model.sequential() 提供什么值? (美国有线电视新闻网)

What values should i provide to my model.sequential() for 500*500*3 image? (CNN)

我使用CNN的目的是用我的500*500*3张车标图片来检测汽车品牌。

model = models.Sequential()
model.add(layers.Conv2D(16, (5, 5), activation='relu', input_shape=(500, 500, 3)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(16, (5, 5),activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(16, (5, 5),activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(16, (5, 5),activation='relu'))
model.summary()

我在那里几乎所有的东西都做了 tweeked,但我的准确性总是很低。

model.add(layers.Flatten())
model.add(layers.Dense(16, activation='relu'))
model.add(layers.Dense(4))
model.compile(optimizer='adam',
              loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
              metrics=['accuracy'])
history = model.fit(train_images, train_labels, epochs=10, 
                    validation_data=(test_images, test_labels))

训练 40 个样本,验证 20 个样本

Epoch 1/10
40/40 [==============================] - 16s 389ms/sample - loss: 1.4333 - acc: 0.1500 - val_loss: 1.3755 - val_acc: 0.2000
Epoch 2/10
40/40 [==============================] - 15s 378ms/sample - loss: 1.3396 - acc: 0.3750 - val_loss: 1.3578 - val_acc: 0.2000
Epoch 3/10
40/40 [==============================] - 15s 378ms/sample - loss: 1.3015 - acc: 0.5500 - val_loss: 1.3506 - val_acc: 0.3000
Epoch 4/10
40/40 [==============================] - 15s 380ms/sample - loss: 1.2058 - acc: 0.4750 - val_loss: 1.4039 - val_acc: 0.3000
Epoch 5/10
40/40 [==============================] - 15s 378ms/sample - loss: 1.0369 - acc: 0.7750 - val_loss: 1.4080 - val_acc: 0.2500
Epoch 6/10
40/40 [==============================] - 15s 378ms/sample - loss: 0.8541 - acc: 0.8250 - val_loss: 1.6827 - val_acc: 0.2000
Epoch 7/10
40/40 [==============================] - 15s 382ms/sample - loss: 0.6846 - acc: 0.8000 - val_loss: 2.1517 - val_acc: 0.2500
Epoch 8/10
40/40 [==============================] - 15s 378ms/sample - loss: 0.4774 - acc: 0.8750 - val_loss: 2.9194 - val_acc: 0.2000
Epoch 9/10
40/40 [==============================] - 15s 378ms/sample - loss: 0.3912 - acc: 0.8750 - val_loss: 4.0575 - val_acc: 0.3500
Epoch 10/10
40/40 [==============================] - 15s 378ms/sample - loss: 0.3832 - acc: 0.8750 - val_loss: 3.7391 - val_acc: 0.4000

请帮帮我!!

500*500*3 训练对你没有任何好处。 CNN 会花时间研究不太重要的特征。最佳尺寸为 64*64。您可以使用 VGGNET、RESNET 等预训练模型将准确度提高到 90% 以上。已经有一个我之前看到的项目正在做类似的事情 Github link