The dark and worrying health picture characterized by the revelations made by international organizations concerning pneumonia challenged us as researchers. It is in this perspective that we decided to make our contribution to this problem by presenting a system for pneumonia detection in chest x-ray images. To achieve this goal, we used an approach based on deep learning to properly identify pathological or non-pathological radiographs by setting up a convolutional neural network called Xception. Two optimization algorithms were selected, namely Adam and SGD. The setting of hyperparameters of our convolutional neural network led us to a promising result compared to the size of our dataset. In conclusion, the obtained results in our experiments showed that the SGD optimization algorithm reached the best result of 92% accuracy on new data with a learning rate of 0.001 for 20 epochs.