Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Deep learning CNN: low accuracy

I am training a convolutional neural network for binary time series classification. The training accuracy on both models is very different. If on the first it grows, then on the second it is always about 40%. There were also strong "jumps". Change filters=32/64/128 and epochs didn’t give the best results(kernel_size = 8).

self.model = keras.Sequential([            
            Conv1D(64, kernel_size=self.kernel_size, activation='relu', input_shape=(self.frame_length, self.N_Feature)),
            BatchNormalization(),
            MaxPooling1D(),    
            
            Conv1D(128, kernel_size=self.kernel_size, activation='relu'),
            BatchNormalization(),
            MaxPooling1D(),    
            
            Conv1D(256, kernel_size=self.kernel_size, activation='relu'),
            BatchNormalization(),
            MaxPooling1D(),    
            
            Dropout(self.dropout_rate),
            Flatten(),
            Dense(self.N_classes, activation='sigmoid')
        ])        
        self.model.compile(optimizer='sgd',loss='binary_crossentropy',metrics='Accuracy')

some learning outcomes

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I am taking a very wild guess (since your question is missing a lot of information), that your "self.N_classes" variable is "2"?

BinaryCrossentropy (your loss) needs it to be "1" though. So instead of labels being "[0, 1]" and "[1, 0]" they should be "0" and "1". If you change your labels, your loss should be calculated meaningfully and your training should work.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading