Gastric cancer can present itself as a gastric ulcer, which can mimic a benign gastric ulcer. In this paper, we introduce an objective and precise gastric ulcer differentiation system based on deep convolutional neural network (CNN) which can support the specialists by improving the diagnostic accuracy of the endoscopic examination of gastric ulcers. We first generated a new dataset consisting of endoscopic images of gastric ulcers and their corresponding type labels obtained by biopsy. We then design various ulcer differentiation models using classification or detection networks, and evaluate the performance of the models on the new dataset. Experimental results confirm that the classification network-based method shows performance comparable to doctors' diagnosis, and the detection network-based one, which first detects ulcer regions and then determines the type of ulcer based on the detection results, exhibits the best performance. The proposed method provides an unbiased diagnosis and it outperforms endoscopic diagnoses performed by the specialists in terms of total accuracy.