i'm quite new to machine learning, so i hope i can get som help on here.
I try to classify pictures of soda-cans and bottles with size 299x299. So based on the shape of the object itself, my networks work very vell. The problem is to get the classification based on the logo right. i.e "coca-cola" vs "fanta". can vs bottle is no problem.
my network is like this:
model = Sequential()
model.add(ZeroPadding2D((1, 1), input_shape=shape
+ (3,)))
model.add(Convolution2D(32, (2,2 ), activation='relu'))
model.add(MaxPooling2D((2, 2)))
model.add(Convolution2D(64, (2, 2), activation='relu'))
model.add(MaxPooling2D((2, 2)))
model.add(Convolution2D(128, (2, 2), activation='relu'))
model.add(Dropout(0.2)) model.add(MaxPooling2D((2, 2)))
model.add(GlobalAveragePooling2D()) model.add(Dense(7, activation='sigmoid'))
sgd = SGD(learning_rate=0.001, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(optimizer=sgd, loss='categorical_crossentropy',metrics=['accuracy'])
Can anyone point me in right direction?
btw: The reason i use sigmoid and categorical_crossentropy in a multiclass classification-problem is because i want to get low scores for all classes if a soda-brand that is not used in my training set is presented in my prediction.
edit:
Ok. My problem is this;
i have these classes:
Cola_bottle_0.5ltr
Cola_bottle_1ltr
Cola_can
Fanta_bottle_0.5ltr
Fanta_bottle_1ltr
Fanta_can
and some more brands...
But, i have also simpliefied this, so i have;
bottle_0.5ltr
bottle_1ltr
can
The model works good with only the shapes and sizes. But when i want to differentiate between brands, the model collapses. A fanta_bottle_1ltr is recognized as a cola_bottle_1ltr.
also, if i want to predict a not-known to the model brand, i.e sprite-bottle. i expect a low score since i use sigmoid in my output-layer, but the model is predicting it as a cola-bottle with 100% confidence.