Simple model which always give the same result. Why?

Hi,

I’ve a very simple Keras program to recognize fruit (5 categories). Here’s a part of the source code :

		model = Sequential()
...
		# define the first (and only) CONV => RELU layer
		model.add(Conv2D(32, (3, 3), padding="same",input_shape=inputShape))
		model.add(Activation("relu"))

		# softmax classifier
		model.add(Flatten())
		model.add(Dense(classes))
		model.add(Activation("softmax"))

It perfectly works. Now I want to design the same CNN with DLS.

Here’s the configuration :

Dataset 
Run4
Dataset	Name: FruitVertical
Type: private
Samples: 282
Mapping	image: {port:InputPort0,shape:,type:Image,options:{Width:28,rotation_range:0,horizontal_flip:false,Augmentation:false,pretrained:None,vertical_flip:false,height_shift_range:0,shear_range:0,width_shift_range:0,Scaling:1,Resize:false,Normalization:false,Height:28}}
fruit: {port:OutputPort0,shape:,type:Categorical,options:{}}
Samples	validation: 28
split: 4
test: 28
training: 225

Model 
Run4
Output_1	
Input_1	
Convolution2D_1	nb_col: 3
nb_filter: 32
nb_row: 3
activation: relu
Flatten_1	
Dense_1	output_dim: 5
activation: softmax

HyperParamerters 
Run4
Epoch	100
Batch Size	32
Custom Loss	false
Loss Function	categorical_crossentropy
Optimizer	lr: 0.005
name: SGD

But after training, all the validation results are the same (kiwi) :

Capture

There’s not a lot of photos (225) but, with the same dataset, if I use the AutoML to generate a (more complex) DL model, it works perfectly so the problem is not with my data (and with my Keras application, it works too with the same data).

What is the problem with my network?

Best regards,

Philippe

Hi Philippe,
This is because your neural net is not learning because of the small size of the network and the data also.
It is working fine with autoML bcz of the large size of neural net implemented in that case.
Have you checked the output of the one you implemented with keras.
I can see there is one diff in both the model of parameter padding=‘same’ in CNN layer but that alone should not make that much difference still try that.

Regards
Rajat

Hi Rajat,

Thank you for your reply.

Here’re the outputs from my Keras program, with the same simple network and small dataset.

As you can see, the training works because the loos is 1.44 at the first epoch and 0.0079 at the echo #200.

So, why this simple network works with my Keras program and not with DLS? I think both use the same Keras API no?

Philippe

I can’t put more than one image in a message so here’re two news messages with other images :

Last image

Hi Philippe ,
Thanks for sharing the details since its a small dataset could you please mail this dataset to us at hello@deepcognition.ai
So that i can check the reason behind this.

Regards
Rajat