I’m currently building a CNN classification model, where its task is to predict correclty the proportion of defects in a given image.
Up until now, all of the models I’ve trained – each analysing an specific defect – performed very well and were able to classify correctly almost 85% of the time, with an average confidence of 70%. The thing is, this defect that I’m supposed to classify now, where the model should be able to identify the proportion of leaves in an image, is not performing well, even after several changes both in the network and in the compilation’s optimizer. The data is fine; it was selected and labeled by professionals who understand it.
Here are some examples:
Class 0: No leaves at all
Image 1
Class 1: A couple leaves (usually 3 or 4)
Image 2
Class 2: A lot of leaves (more than 4)
Image 3
As I said, I’ve tried multiple networks, from simple to deep ones, with and without regularization.
In addition, I tried masking the images, to supply the network only with the wanted parts, excluding the machinery; no better result.
As I can’t show all the networks and parameters I’ve tried (because it a lot), here’s the default network I used to train my other models, and that worked pretty well for the classification of other defects:
var model = Sequential()
model.add(Conv2D(32, kernel_size=(3, 3), padding="same", activation="relu", input_shape=(height, width, 3), kernel_regularizer="l2"))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.2))
model.add(Conv2D(64, (3, 3), padding="same", activation="relu", kernel_regularizer="l2"))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.2))
model.add(Conv2D(64, (3, 3), padding="same", activation="relu", kernel_regularizer="l2"))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.2))
model.add(Flatten())
model.add(Dense(256, activation="relu", kernel_regularizer="l2"))
model.add(Dropout(0.5))
model.add(Dense(classesCount, activation="softmax"))
model.compile(optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy", TrueNegatives(), FalseNegatives(), TruePositives(), FalsePositives()])
Gilmar Coop is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.