Endoscopic image diagnosis assisted by machine learning is useful for reducing misdetection and interobserver variability. Although many results have been reported, few effective methods are available to automatically detect early gastric cancer. Early gastric cancer have poor morphological features, which implies that automatic detection methods can be extremely difficult to construct. In this study, we proposed a convolutional neural network-based automatic detection scheme to assist the diagnosis of early gastric cancer in endoscopic images. We performed transfer learning using two classes (cancer and normal) of image datasets that have detailed texture information on lesions derived from a small number of annotated images. The accuracy of our trained network was 87.6%, and the sensitivity and specificity were well balanced, which is important for future practical use. We also succeeded in presenting a candidate region of early gastric cancer as a heat map of unknown images. The detection accuracy was 82.8%. This means that our proposed scheme may offer substantial assistance to endoscopists in decision making.